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.
You can implement this use case in your storefront by following the steps listed below:
- Log in to Business Manager.
- Go to Administration > Global Preferences > Feature Switches.
- Check Enable Shopper Context.
- 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.
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
deviceType 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
The sequence of calls to get the shopper context API is:
- Request a SLAS access token.
- Call the PUT Shopper Context API (in the scope of USID returned with the SLAS access token).
- 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.
- Make an API call to set the shopper’s context.
- After the context is set, make a call to
- 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,
deviceType = mobile), which can trigger a promotion, such as a 10% discount.