Marketplace Apps
Connect your commercetools products with Agility
Connect your CommerceTools products with Agility CMS. The CommerceTools App allows content editors to browse, search, and attach product information from CommerceTools directly within Agility CMS content items.
The CommerceTools App provides a seamless integration between Agility CMS and CommerceTools, enabling you to:
Before installing the CommerceTools App, you need an active CommerceTools account with a configured project. If you don't have one, sign up at commercetools.com.
Before configuring the app in Agility CMS, you'll need to create an API client in CommerceTools and gather your project configuration details.
view_products:{projectKey} scopeImportant: The API client credentials are only displayed once. Make sure to copy and save the following information before leaving the page:
You can optionally download the credentials as an .env file for safekeeping.
Your region is visible in your Merchant Center URL. The format is:
https://mc.{region}.commercetools.com/{projectKey}/...
Common regions include:
us-central1.gcp - US Central (Google Cloud)us-east-2.aws - US East (AWS)europe-west1.gcp - Europe West (Google Cloud)eu-central-1.aws - EU Central (AWS)australia-southeast1.gcp - Australia Southeast (Google Cloud)Example: If your URL is https://mc.us-central1.gcp.commercetools.com/my-store/..., your region is us-central1.gcp.
The locale defines the language and region for your product data. Common locales include:
en-US - English (United States)en-GB - English (United Kingdom)de-DE - German (Germany)fr-FR - French (France)es-ES - Spanish (Spain)To find which locales your products use:
Choose the primary locale that your products are published in.
For search functionality in the product selector:
Without this feature, the app will function but search will be unavailable, and only browsing will be possible.
After installation, configure the app with your CommerceTools credentials:
In the app settings, provide the information you gathered from CommerceTools:
us-central1.gcp)en-US)Click Save to store your configuration
The app will validate your credentials and connect to your CommerceTools project.
When creating or editing content:

Click Browse Products to open the product selector modal
Browse through your product catalog or use the search bar (if enabled):

Click on a product to select it
The product details will display in the field, including:

To remove a selected product:
The CommerceTools Product field stores product data as a JSON string. When you retrieve your content, the field value contains:
{
"id": "abc123-def456-ghi789",
"entityId": 12345,
"name": "Example Product",
"sku": "PROD-001",
"path": "example-product",
"description": "Product description",
"image": {
"listingUrl": "https://example.com/image-list.jpg",
"detailUrl": "https://example.com/image-detail.jpg"
}
}
When rendering content in your application, parse the product field value and use it to display product information or fetch additional details from CommerceTools:
import { useEffect, useState } from 'react';
function ProductDisplay({ productFieldValue }) {
const [product, setProduct] = useState(null);
useEffect(() => {
if (productFieldValue) {
// Parse the JSON string from the field
const productData = JSON.parse(productFieldValue);
setProduct(productData);
}
}, [productFieldValue]);
if (!product) return null;
return (
<div className="product-display">
<img src={product.image.detailUrl} alt={product.name} />
<h2>{product.name}</h2>
<p>SKU: {product.sku}</p>
{/* Fetch additional details from CommerceTools API using product.id */}
</div>
);
}
import { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk';
import { ClientBuilder } from '@commercetools/ts-client';
async function getProductDetails(productId, projectKey, clientId, clientSecret, region) {
// Create CommerceTools client
const client = new ClientBuilder()
.withProjectKey(projectKey)
.withClientCredentialsFlow({
host: `https://auth.${region}.commercetools.com`,
projectKey,
credentials: { clientId, clientSecret },
scopes: [`view_products:${projectKey}`]
})
.withHttpMiddleware({
host: `https://api.${region}.commercetools.com`
})
.build();
const apiRoot = createApiBuilderFromCtpClient(client).withProjectKey({ projectKey });
// Fetch full product details
const response = await apiRoot
.products()
.withId({ ID: productId })
.get()
.execute();
return response.body;
}
// In your page component
export async function getStaticProps({ params }) {
// Fetch content from Agility CMS
const contentItem = await getContentItem(params.slug);
// Parse product field
const selectedProduct = JSON.parse(contentItem.fields.featuredProduct);
// Fetch full product details from CommerceTools
const productDetails = await getProductDetails(
selectedProduct.id,
process.env.CT_PROJECT_KEY,
process.env.CT_CLIENT_ID,
process.env.CT_CLIENT_SECRET,
process.env.CT_REGION
);
return {
props: {
contentItem,
productDetails
}
};
}
view_products scope only)Problem: The search bar doesn't appear in the product selector, or a message states "Search Not Enabled"
Solution:
Problem: The product selector shows an error or no products appear
Solution:
view_products:{projectKey} scopeProblem: Selected product information doesn't appear in the content item
Solution:
Problem: Errors when parsing the product field value
Solution:
Problem: Clicking the SKU link doesn't open the product in Merchant Center
Solution:
For issues specific to the CommerceTools App integration with Agility CMS, please contact Agility CMS Support.
For questions about CommerceTools product data, API access, or platform features, refer to CommerceTools Support.