Custom external references with commercetools
Overview
You can integrate Custom external references with commercetools. With Custom external references, you can retrieve commercetools products and product categories through the Contentful GraphQL API. This way, you can get all the information you need in a single API call to create a great customer experience.
Enable Custom external references for commercetools
To enable Custom external references for commercetools:
Configure your commercetools project.
Log in to the Contentful web app.
Install the commercetools app in the Contentful web app.
Configure the credentials needed inside the Contentful commercetools App configuration screen. For more information on how to set up the credentials, see step 2 of the commercetools page.
Navigate to the “Content model” tab and select the content type you want to retrieve data from with Custom external references.
Click +Add field and add a new field of type “Text”.
In the "Appearance" section, under "Choose how this field should be displayed", select commercetools.
Select the Resolve content on delivery check box.
Click Confirm.
Save your changes.
Query commercetools data in Contentful using the GraphQL API
To query Shopify data in Contentful using the GraphQL API:
Open your preferred GraphQL client or use an online IDE. You can also use our GraphQL Playground app.
Insert the following GraphQL query as an example, replacing "ENTRY_ID" with the ID of the product you want to query:
Run the query.
For more information on adjusting your GraphQL API queries and possible errors, see the technical Custom external references and GraphQL API documentation.