This feature is a Beta Service. You may opt-in to try this service at your sole discretion. Any use of this service is subject to the Customer Agreements and User Terms for Products and Services.


Personalized Promotions, Shipping, and Payment Methods

Get Personalized Promotions, Shipping, and Payment Methods based on shopper’s device type. For example, shoppers whose device type is mobile, get 10% off with free shipping and the option to pay using Google pay.

ShopperContextPersonalized

You can implement this use case in your storefront by following the steps listed below:

  1. Log in to Business Manager, and navigate to Administration > Feature Switches.
  2. Search for “Enable Shopper Context awareness”, and enable the feature toggle. There’s no need to specify the Base URL Override unless there’s a routing issue.

ShopperContextToggle

Merchants don’t have access to enable this feature toggle.

  • The Shopper Context API works with session-based customer groups.
  • You have to create a session-based customer group and make sure the attribute used in the customer group matches with the shopper context qualifier.

ShopperContextToggle

The custom attribute set in the dynamic customer group in Business Manager and the custom qualifier set in the API should match. As a best practice, use only those qualifiers that exist in dynamic session-based customer groups and assignments. In this example device_type is the attribute used in customer group and shopper context. This Shopper Context data is then used to retrieve customer groups that a particular shopper belongs to, and activates any experiences that are mapped to a particular customer group.

To set the context, use PUT https://{shortCode}.api.commercecloud.salesforce.com/shopper/shopper-context/v1/organizations/{organizationId}/shopper-context/{usid}

The sequence of calls to get the shopper context API is:

  1. Request a SLAS access token.
  2. Call the PUT Shopper Context API (in the scope of USID returned with the SLAS access token).
  3. Call SCAPI, for example GET product or basket.

After the shopper is logged out, the shopper’s context is deleted.

Shopper Context API enables you to personalize headless storefronts. This API works with existing Salesforce Commerce APIs (a.k.a SCAPI) such as: Basket, Shipping, Payment, and Product.

Consider a scenario where you want to personalize the products page based on a shopper’s device type by displaying certain products for shoppers whose device type is mobile.

  1. Make an API call to set the shopper’s context.
  2. After the context is set, make a call to GET products (SCAPI).
  3. The response of GET products has a new property, “Product Promotion”, which lists all the promotions associated with the product and matching the shopper context criteria; or the response may have the discounted price based on the shopper context.
    • The merchant can set the effective date in Shopper Context to trigger special price books.
    • The merchant can have a dynamic session-based customer group (for example, device_type = mobile), which can trigger a promotion, such as a 10% discount.

Shopper Context | B2C Commerce API | Salesforce Developers

Shopper Login (SLAS) | B2C Commerce API | Salesforce Developers

Salesforce Commerce Cloud Infocenter