Salesforce Commerce is a seamless cloud-based eCommerce platform that can help deliver a personalized and cohesive commerce experience. With its robust online store management features, you can set up an online store, create AI-powered shopping experiences and grow your online businesses.
Contentstack Marketplace allows you to easily install the Salesforce Commerce app and use it within your stack to add products and categories from the Salesforce Commerce store within your entries.
Follow this step-by-step guide to install and configure the Salesforce Commerce app.
Note: Ensure you have a working Salesforce account. If not, visit the official website.
To retrieve the API client ID, login in to Commerce Cloud Account Manager, and follow the steps given below:







Enter the following scopes in Default Scopes:
mail roles tenantFilter profile openId
Enter the following scopes in Allowed Scopes:
sfcc.shopper-baskets-orders.rw
sfcc.shopper-promotions
sfcc.shopper-gift-certificates
sfcc.shopper-categories
sfcc.shopper-product-search
sfcc.shopper.stores
sfcc.shopper-customers.register
sfcc.shopper-customers.login
sfcc.shopper-myaccount.rw
sfcc.shopper-myaccount.addresses.rw
sfcc.shopper-myaccount.baskets
sfcc.shopper-myaccount.orders
sfcc.shopper-myaccount.paymentinstruments.rw
sfcc.shopper-myaccount.productlists.rw
sfcc.products.rw
sfcc.catalogs.rw
sfcc.shopper-products
sfcc.shopper-productlists
Note: By default, you will see the scope mail in the Default Scopes.


To get the Short Code, Organization ID, and Site ID, follow the steps given below:
Note: Contact the Salesforce support team to get the Business Manager account link.


Note: Before retrieving the Client Secret, go to the Authorization for Shopper APIs guide and follow the steps listed in the Set Up User Roles and Filters section to set the SLAS Organization Administrator roles.
To get the Client Secret, follow the steps given below:
https://{{short-code}}.api.commercecloud.salesforce.com/shopper/auth-admin/v1/ui/Note: Replace the {{short-code}} in the URL with the Short Code retrieved in the previous step.

Note: The tenant ID will be the same as the last portion of your organization ID. For example, if the organization ID is abc_zybz_001, the tenant ID will be zybz_001.

Note: Your app, by default, is Public.

To install the app in Contentstack, log in to your Contentstack account and follow the steps below:




Note: If you do not specify any value, the default value sets to 1.

Alternatively, you can set a configuration as the default by clicking the three dots on the top-right side of the configuration section and then selecting Set as Default.

Note: At least one app configuration should be selected as the default.
Similarly, you can add multiple configurations by following the steps discussed above.

In the Confirm Deletion modal, add the configuration name and click Delete.


Warning:

Note: When you disable the Advanced Settings, all the saved configurations will be cleared.
Enable the Locale Support toggle to add localized products and categories based on the selected locale in your entry.

Locale Support and Mapping Locales: Use the Locale Mapping section to define mappings between your Contentstack locales and Salesforce Commerce locale codes.
Click Add Locale to create a new mapping. Each mapping ensures that when you switch locales in Contentstack, the corresponding Salesforce Commerce data loads automatically in the selector page.

Note: This is a one-to-many mapping, allowing all Salesforce Commerce locales to be easily mapped to a Contentstack locale.
Locale Fallback Configuration
For reliable product retrieval across all languages, you must ensure your Salesforce Commerce locale fallback is correctly configured in the Business Manager.
Navigate to Merchant Tools > Site Preferences > Locales. For each active locale, verify the Fallback Locale setting.

Tip: To ensure maximum content availability, set the Fallback Locale ID to Default. This ensures that if content is unavailable in a specific language, Salesforce Commerce will automatically retrieve the content from the universally configured Default Locale.
Each rule requires the following details:
Once configured, when you select a product or category in the specified content type, the URL automatically populates in the mapped field.


If you select Custom Fields then the Salesforce Commerce Keys drop-down appears. By default, id and name keys are already selected.
Note: To view the variants of products in the selector page and custom field within the entry, select the variants key.
If you want to create a new key, click the + New Key Field option.

In the Add Salesforce Commerce Key Field modal, enter the Key Name or Path and click the Create button to create a new key.


Once you save your configuration, the selected columns appear in the custom field’s list view on the entry page. You can also update or remove columns at any time to refine the view.

Note: The app requires at least one UI location to be enabled, otherwise you will not be able to save your app configuration settings.
Additional Resource: For more information on UI location and webhooks, please refer to the Installed Apps guide.
To use the Salesforce Commerce app within an entry of your stack, follow the steps given below:


This adds Salesforce Commerce - Product in the custom field.


This adds Salesforce Commerce - Category in the custom field.

The key:value passed in the configuration object overrides the default app configuration settings.
If you want to use a different Salesforce Commerce configuration for any custom field within the same stack, you need to specify the configuration name in the Config Parameter as follows:
Configuration Object:
{
"config_label": [
"Configuration-2"
]
}
Locale Based Configuration Object: To add a locale-based configuration, add a locale parameter to the additional configuration object which specifies the locale value (for example: en-us) as the object key and the configuration object as the value to the locale.
Locale Configuration Object:
{
"config_label": [
"Configuration-1",
"Configuration-2"
],
"locale": {
"en-us": {
"config_label": []
},
"en-ZA": {
"config_label": []
}
}
}Max Limit: You can set the maximum number of assets that can be added in the Custom field. In our example, it is 4.
{
"advanced": {
"max_limit":4
}
}
Note: If any configuration value is not added, or if all the values are empty in the Config Parameter properties settings, the Salesforce Commerce app uses the default credentials configured in the installation in step 2.
You can see the Salesforce Commerce app’s custom fields on your entry page as shown below:



You can select the products from multiple configurations at once using the Configuration drop-down.

When the Locale Support is enabled during the app configuration in step 2, you can select the locale-based products using the Locale drop-down in the selector page.

Note:
You can also search for products in the Salesforce Commerce selector page based on the product name.
Hover over the product on the Salesforce Commerce selector page, and you can see the View in Salesforce Commerce option to go directly to the Salesforce Commerce platform.

The products you selected get referenced within your entry in the thumbnail view.

Select the list view option from the dropdown to view the products in the list view.

The products you selected get referenced within your entry in the list view.

If you select All Fields to save in the entry or add the Variants key in the Custom Fields option during app configuration in step 2, you can add and view the Variants of the products directly within the entry.
While adding products in the entry, you can view the variants corresponding to a product in the selector page. Select the product and respective variants, and then click the Add Products button.

You can view the product in the entry along with the variants at the bottom within each product card.
To view the variants in Product List view, you need to select the variant checkbox under the Customize List View Options during app configuration in step 2.

Thumbnail View

List View


Note: You must save your entry to get the product details in the Sidebar Widget.


You can select the categories from multiple configurations at once using the Configuration drop-down.

When the Locale Support is enabled during the app configuration in step 2, you can select the locale-based categories using the Locale drop-down in the selector page.

Note:
You can also search for categories in the Salesforce Commerce selector page using the Category Name.
Hover over the category on the Salesforce Commerce selector page, and you can see the View in Salesforce Commerce option to go directly to the Salesforce Commerce platform.

The categories you selected get referenced within your entry in the thumbnail view.

Select the list view option from the dropdown to view the categories in the list view.

The categories you selected get referenced within your entry in the list view.

Thumbnail View

List View

When you have enabled the URL Auto Populate feature and configured Rules during app configuration in step 2, it activates automatically when you start working with an entry.

When you open an entry for the configured Content Type and select a product or category via the Custom Field, the app instantly fetches the corresponding data from Salesforce Commerce, extracts the value from the defined Key Name, and updates the Contentstack entry's main URL field.
For Product Custom Field, the slugURL is appended to the URL field.

For Category Custom Field, the id is appended to the URL field.

Note: If the custom field allows multiple selections, the URL Auto Populate feature will always use the URL of the first product or category added to the field.
While defining the rule in the app configuration in step 2, if the Entry Level toggle was set to ON, then you see the URL Auto Populate toggle button within the custom field.

By default, the URL Auto Populate toggle is disabled within the entry. You need to enable the toggle button to add the unique URL automatically in the entry.

Note:
Tip: Recommended to use the max-limit functionality to restrict the number of products or categories that can be added to a custom field. For URL Auto Populate, set the limit to 1 to ensure only a single product or category is selected per rule for accurate URL mapping.