Challenge

Build your Composable Commerce developer skills by completing our challenge.

  • After completing this page, you should be able to:

    • Demonstrate that you can create, maintain, and query resources in Composable Commerce.
  • Congratulations on reaching this milestone!

    You've completed the Developer Essentials Learning Path and are now ready to put your new Composable Commerce skills to the test. This challenge module will help you solidify your knowledge and gain practical experience.

    This challenge module provides:

    • Practical tasks to complete using your preferred SDK.
    • The flexibility to tackle the challenge your own way. While we recommend working through the tasks in order, feel free to pick and choose what tasks to work on.

    When you are ready, you can start working your way through the tasks. Once you've completed the challenge, mark this module as complete using the quiz feature at the bottom of the page.

    Prepare your environment

    1. Update the Countries, currencies, and languages to support Australia and New Zealand.
    2. Enable indexing on Orders.
    3. Read the Project settings and programmatically check that you have the expected settings. Take note of the trialUntil information.

    Authentication and authorization

    1. Create an API Client that will delete itself after 30 days.

    2. Create an apiRoot that will generate an anonymous token with the following scopes:

      • View Categories
      • View Products (published)
      • View Shipping Methods
      • My Shopping Lists
      • Create anonymous Token
    3. Integrate with a logging solution that supports OpenTelemetry. You can find more information in the TypeScript SDK repository. Make sure that the solution works by sending some errors to the OpenTelemetry provider.

    4. Simulate terminating a customer's session by revoking their token. Work out which OAuth scope is required to complete this action.

    CRUD operations

    1. Update a Customer's phone number:
      1. Create a function that takes a Customer key, version, and updates the phone number.
      2. Handle version mismatch.
    2. Check if a specific Product Variant (identified by an sku) is in stock for a given Store.
      1. Fetch the Product Variant using Product Search or Product Projection Search.
      2. Determine if there is at least one Inventory entry for the Store.
      3. Console log a user-friendly message indicating availability.
    3. Build a set of functions to manage a basic Shopping Cart.
      1. Create a new Cart for an anonymous user.
      2. Add a Product (which has available inventory) to the Cart.
      3. Increase the quantity of the existing Line Item in the Cart (check that you have enough inventory for this item to complete the action).
      4. Make multiple changes to the Cart in a single request. This should include creating a Cart, adding an email address, Line Item, Country, and Locale.

    HTTP API queries and Query Predicates

    1. Write a function that retrieves all Customers from a specific country.
    2. Modify the previous function to retrieve Customers from a specific city within a Country, ensuring the search is case-insensitive. (Hint: explore Query Predicates in the documentation).
    3. Make a request to get data for a Product Listing Page.
      1. Facets displayed should be: Price and Category
      2. Twelve Products should be displayed at a time. Display the second page of results.
      3. Products should be ordered by the setCategoryOrderHint. This ensures that Products are displayed in the correct merchandised order.
      4. Filter by a single Store projection.
      5. Use the Product Projections or Product Search endpoint.
    4. Create a function that takes a Category's id and a maximum price as input and returns all the Products within that Category below the specified price.
    5. Write a function that accepts an array of sku and returns all products that have at least one Product Variant matching any of the provided sku values.

    Work with GraphQL

    1. Make a request to get data for a Product listing page:
      1. Facets displayed should be: Price and Category
      2. Twelve Products should be displayed at a time. Display the second page of results.
      3. Products should be ordered by the setCategoryOrderHint. This ensures that Products are displayed the correct merchandised order.
      4. Use the Product Projections or Product Search endpoint.
      5. Filter by a single Store projection
      6. The values returned should be the Product's name, ID, slug, Master Variant Image, price, and availability.
    2. Implement the functionality to add a Product Variant to a Customer's Cart using GraphQL mutations.
      1. Before adding the item to Cart, check that there is enough stock for the expected Store. If there is insufficient stock, log a message to the console.
    3. Create a GraphQL query that shows Customers their previous five orders. The customer should see the:
      1. Order ID
      2. Subtotal
      3. Shipping name
      4. Shipping price
      5. Grand total
      6. Order status
      7. Payment status
      8. Shopping address
      9. Billing address
      10. Line Item values: lineItems, SKU, price, special price, quantity, and total
      11. Bonus: sort and paginate using createdAt.

    Import API

    1. Create an Import Container: programmatically create an Import Container for Products using the SDK.
    2. Retrieve an Import Container: fetch and log the details of the created Import Container using its key.
    3. List all Import Containers: retrieve and display a list of all Import Containers and their status in your Project.
    4. Simulate a bulk Customer import and resolve any encountered errors using this sample Customer data.
      • This sample Customer data contains various common import issues, such as missing dependencies.
      • Your goal is to achieve a clean import of all ten customers in the sample data. This requires identifying and fixing errors within the sample data and ensuring your Composable Commerce Project is properly configured to accept the data.

    Mark as completed