commercetools Composable Commerce extension

commercetools Frontend comes with the ready-to-use commercetools Composable Commerce extension. With the extension, you can fetch data from commercetools Composable Commerce and display it in your Frontend components.

Information icon

Prerequisites

Use the commercetools Composable Commerce extension

You can find the commercetools Composable Commerce extension in your commercetools Frontend project at the following path: /packages/<project>/backend/commerce-commercetools.

To use the commercetools Composable Commerce extension you must:

  1. Add your commercetools Composable Commerce credentials to the project.yml file in your commercetools Frontend project.
  2. Add data source schemas to the studio.

Add commercetools Composable Commerce credentials

To add your commercetools Composable Commerce credentials to your commercetools Frontend project, follow these steps:

  1. Go to <customer>-<project>/<project>/config and open the project.yml file.
  2. Copy the following sample code and paste it in the configuration section of the project.yml file.
  3. Replace comments with your commercetools Composable Commerce credentials.
Warning icon

Edit only the configuration section. Otherwise, you will lose your commercetools Frontend project setup.

Set Composable Commerce credentials in the configuration section of project.ymlyaml
commercetools:
clientId: # your unique client ID for commercetools Composable Commerce
clientSecret: # your unique client secret for commercetools Composable Commerce
projectKey: # your unique project key for commercetools Composable Commerce
authUrl: # the authorization URL for commercetools Composable Commerce
hostUrl: # the host of the HTTP API service for commercetools Composable Commerce
product: # duplicate this section for account, cart, search, wishlist
engine: commercetools
Clipboard icon

Add data source schemas to the studio

In your commercetools Frontend project, at the /packages/<project>/backend/schemas/dataSource path, you can find the following data source schemas:

  • The frontastic-product-list.json product list schema
  • The frontastic-product.json single product schema

To add the data source schemas to the studio, follow these steps:

  1. From the studio home page or from the left navigation menu, go to Developer > Data sources.

  2. Click Upload schema.

  3. Search and select the JSON file to upload: the schema editor opens.

  4. Click Publish to add the schema.

You can now use the commercetools Composable Commerce extension to fetch data to be displayed in the Frontend components.

Edit the commercetools Composable Commerce extension

You can edit the commercetools Composable Commerce extension to adapt it to your needs.

We recommend adding code to extend the extension's functionality rather than deleting or replacing anything. That way, when extension updates are released, they will be easier to apply.

To update your code, clone the commercetools Composable Commerce extension GitHub repositoryExternal link icon.