You are here:
Configure MRT and Trusted Domains for the Shopper Agent for Storefront Next
For the Shopper Agent to work with Storefront Next, set up managed runtime (MRT). MRT provides the infrastructure for your Storefront Next storefront, and it enables the Shopper Agent to communicate with the Enhanced Chat service in your Salesforce org. Set the correct environment variables in Managed Runtime for your deployed bundle.
Required Licenses: See Required Licenses for the B2C Shopper Agent.
Complete these prerequisites.
To enable and configure Shopper Agent for Storefront Next, set up a messaging channel and create an embedded service deployment by using the steps in Guided Shopping for B2C Commerce.
Configure MRT and Trusted Domains for the Shopper Agent
-
Complete these prerequisites:
- Confirm you can access the Managed Runtime Admin console.
- Confirm that Enhanced Chat is enabled in your Salesforce org and the channel is connected to your Shopper Agent.
-
Create a Storefront Next storefront in Business Manager.
See Create a Storefront in Business Manager with a GitHub Repository or Create a Storefront in Business Manager with Local Code in the Storefront Next Guide.
- To go to the Environment Variables page in Runtime Admin, from the storefront detail page, click the associated MRT environment, and then click Manage next to Environment Variables.
-
In the Environment Variables page, add the
PUBLIC__app__commerceAgentvariable.For the variable value, enter the JSON-encoded settings that the Shopper Agent Enhanced Chat configuration uses. This example shows the settings. Replace the placeholders for the org name, the storefront site path, and the org ID. Replace the example values with the values for your storefront.
{ "enabled": "true", "embeddedServiceName": "storefront_next_market_street", "embeddedServiceEndpoint": "https://<your-org-name>.test2.my.pc-rnd.site.com/<your-storefront-site-path>", "scriptSourceUrl": "https://<your-org-name>.test2.my.pc-rnd.site.com/<your-storefront-site-path>/assets/js/bootstrap.min.js", "scrt2Url": "https://<your-org-name>.test2.my.pc-rnd.salesforce-scrt.com", "salesforceOrgId": "<your-org-id>", "siteId": "storefrontnext" }Find the values for these settings in the chat code snippet of your Enhanced Chat embedded service deployment:
salesforceOrgId: First argument toembeddedservice_bootstrap.init().embeddedServiceName: Second argument toembeddedservice_bootstrap.init().embeddedServiceEndpoint: Third argument toembeddedservice_bootstrap.init().scrt2Url: Value ofscrt2URLinside the options object (fourth argument toembeddedservice_bootstrap.init()).scriptSourceUrl: Thesrcattribute on the<script>tag at the bottom of the snippet (thebootstrap.min.jsURL).siteId: Your B2C Commerce site ID. Not in the snippet; set it to your storefront site ID (for example,"storefrontnext").enabled: Not in the snippet. Set to"true"to activate the Shopper Agent.
-
Add the storefront and Business Manager domains to the list of Trusted URLs in Salesforce.
-
In your Salesforce org, at the top of the page, click
and select Setup.
- In the Quick Find box, enter Trusted URLs and then select Trusted URLs.
- Add the storefront and Business Manager domains to the list of Trusted URLs in Salesforce.
-
In your Salesforce org, at the top of the page, click
The Shopper Agent is now configured for your Storefront Next storefront.

