Salesforce Commerce App Installation Guide
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 application and use it within your stack to add products and categories from the Salesforce Commerce store within your entries.
Prerequisites
- Salesforce Commerce account
- Contentstack account
- Access to the Contentstack Organization/Stack as the Owner/Admin
This step-by-step guide explains how to install and configure the Salesforce Commerce app within your stack.
Steps for Execution
- Retrieve your client credentials from Salesforce Commerce
- Install and Configure Salesforce Commerce in Contentstack Marketplace
- Use Salesforce Commerce within your Stack
-
Retrieve your client credentials from Salesforce Commerce
Follow the steps given below to retrieve the API client ID:
- Log in to Commerce Cloud Account Manager.
- Click API Client from the menu.
- Click the Add API Client button.
-
Provide the following details for the new API client:
- Enter a Display Name and set a Password.
-
Add an organization.
- Click the Add button for Organizations.
- Select your organization and click the Add button.
-
Add roles.
- Click the Add button for Roles.
- Select the required roles and click the Add button.
-
Add scopes under OpenID Connect.
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
- Select client_secret_post as the Token Endpoint Auth Method.
- Click the Save button to get the API client ID.
Now you can see your API client ID in the Account Manager screen. - Copy the API client ID for future reference.
Note: By default, you will see the scope mail in the Default Scopes.
Follow the steps given below to retrieve the Short code, Site Id, and Organization Id:
- Log in to Business Manager using the Account Manager credentials.
- Go to Administration and click Site Development.
- Click Salesforce Commerce API Settings on the following screen.
- Click the Request Short Code button to retrieve the Short Code.
- Click the Copy to Clipboard buttons next to Short Code and Organization Id and store these values for future purposes.
- Go to Administration and click Sites.
- Click Manage Sites on the following screen.
- Note down the required Site Id from the list or create a new one.
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.
Follow the steps given below to retrieve the Client Secret:
-
Use the following URL to open the SLAS User Login page.
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 steps.
- Log in to SLAS Admin UI using the Account Manager credentials.
- From the menu on top, click Clients.
- Click the Add Client button.
-
On the next screen that appears, provide the following details:
-
In the What tenant will be used? dropdown, select your tenant ID.
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.
- In the What site will be used? dropdown, enter the site name if the site is not already populated.
- Enter the API client ID retrieved in the previous steps in the Client ID field.
-
In the What tenant will be used? dropdown, select your tenant ID.
- Click the Submit button.
You can view the Client Secret generated at the top. - Copy and save the Client Secret.
- Follow the steps below if you want to make your app Private:
- From the menu on top, click Clients.
- Click the Edit option under Actions against your Client ID.
- Mark the checkbox next to Private?.
- Click the Submit button.
Your app, by default, is Public.
-
Install and Configure Salesforce Commerce in Contentstack Marketplace
Follow the steps given below to install the application in Contentstack.
- Log in to your Contentstack account.
- In the left-hand side primary navigation, click the Marketplace icon to go to the Marketplace.
- Click Apps from the left panel.
- Within the Marketplace, you will be able to see all the available apps. Hover over the Salesforce Commerce app and click Install App.
- In the popup window, select the stack where you want to install the Salesforce Commerce app and click the Install button.
-
On the Configuration screen, enter the following details:
- Enter the Client Id (API client ID), Client Secret, Organization Id, Site Id, and Short Code retrieved from your Salesforce Commerce account in step 1.
-
Save in Entry: Choose how you want to save your data in the entry.
- If you select the All Fields option, the entire object returned from Salesforce Commerce will be saved. Also, you can choose only a limited number of products or categories.
- If you select Custom Fields, you need to search and add specific Salesforce Commerce Keys you want to fetch. The default selections are productId and productName.
- On the UI Locations tab, you can see the predefined app locations. You can use the toggle button corresponding to each UI location to enable or disable it based on your requirements.
- If the webhook is enabled for your app, you can view the webhook logs under the Webhook tab.
- After adding the configuration details, click the Save button.
- Click Open Stack to start using the Salesforce Commerce application.
Note: You cannot remove the default keys from the selection for Custom JSON.
Additional Resource: For more information on UI location and webhooks, please refer to the Installed Apps guide.
- Log in to your Contentstack account.
-
Use Salesforce Commerce within your Stack
To use the Salesforce Commerce application within an entry of your stack, follow the steps given below:
- Go to your stack, click the Content Models icon in the left navigation panel, and click the + New Content Type button.
- Create a content type by entering relevant details as given below:
- In the Content Type Builder page, add a Custom field for product in your content type by clicking the Insert a field link represented by a + sign.
- Under Select Extension/App, select Salesforce Commerce - Product and click the Proceed button.
This adds Salesforce Commerce - Product in the custom field.
- Add another Custom field for category in your content type by clicking the Insert a field link represented by a + sign.
- Under Select Extension/App, select Salesforce Commerce - Category and click the Proceed button.
This adds Salesforce Commerce - Category in the custom field.
- After adding the app, click Save or Save and Close to save your changes.
- To use the Salesforce Commerce app, create an entry for this content type. In the left navigation panel, navigate to the Entries page, click + New Entry to create a new entry for the above content type, and then click Proceed.
You can see the Salesforce Commerce app’s custom fields on your entry page as shown below: - Click the Add Product(s) button to choose the product(s).
- Select the products from your Salesforce Commerce store and click the + Add Product(s) button to add them to your entry.
The products you selected are 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 are referenced within your entry in the list view.
-
To reorder, open in Salesforce CC, or delete the selected product, hover over the product to get the options available, then perform the following:
- Click the Drag icon to drag and reorder the product.
- Click the Open in Salesforce CC icon to open the product in the Salesforce Commerce app.
- Click the Delete icon to delete the product.
- Click the Save button to save your entry.
- You can view more product details in the Sidebar Widget.
- Click the Add Category(s) button to choose the product(s).
- Select the products from your Salesforce Commerce store and click the + Add Category(s) button to add them to your entry.
The category(s) you selected are referenced within your entry in the thumbnail view.
Select the list view option from the dropdown to view the category(s) in the list view.
The category(s) you selected are referenced within your entry in the list view.
-
To reorder, open in Salesforce CC, or delete the selected category, hover over the category to get the options available, then perform the following:
- Click the Drag icon to drag and reorder the category.
- Click the Open in Salesforce CC icon to open the category in the Salesforce Commerce app.
- Click the Delete icon to delete the category.
- Click the Save button to save your entry.
Thumbnail View
List View
Note: You must save your entry to get the product details in the Sidebar Widget.
Thumbnail View
List View
- Go to your stack, click the Content Models icon in the left navigation panel, and click the + New Content Type button.