The Commerce Layer app allows editors to select products from their Commerce Layer account and reference them in Contentful entries.
To use this app, you will need:
- An account with Commerce Layer.
- A content type with a field of type
Short text, list.
Step 1: Install
To install this app:
- Acquire Commerce Layer credentials to use with the app by following these steps on the Commerce Layer website:
- Select your Organization and go to Settings > Applications > New Application.
- Fill in a name and in the integration
contentfulas the value.
- Click on the newly created entry and copy the client ID and base endpoint to use with in the app's installation screen.
- Fill in the credentials in the Commerce Layer app installation screen.
- Select all fields for which you would like to install the Commerce Layer app from the list of available fields.
- Click on
This will modify the fields in the selected content types and change their appearance to use the Commerce Layer app.
Step 2: Use the product picker to select products on Commerce Layer
To reference Commerce Layer products from your Contentful entries:
- Navigate to the
- Select or create a new entry of the content type for which you installed the app.
- Find the field and click on "Select product".
- Scroll through the available product pages or search for a specific item by name or SKU and select the products you want then click "Save".
- Your selection should now show up like this:
What is the difference between installing the app for a field of type Short text vs Short text, list?
When the app is installed for fields of type
Short text, the product picker widget will only allow you select a single product. For fields of type
Short text, list, the widget will allow you to select multiple products.
How can I query the Commerce Layer API for the SKUs I saved in my Contentful entries?
To fetch the data for the products corresponding to the SKUs you have selected and saved in your Contentful entries, you will need to query the SKUs endpoint of the Commerce Layer API with a filter applied for your SKUs.