Creates the shopper's context based on shopperJWT.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
If you would like to get a raw Response object use the other createShopperContext function.
An object containing the options for this method.
A promise of type void | void.
Creates the shopper's context based on shopperJWT.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void | void otherwise.
Gets the shopper's context based on the shopperJWT.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
If you would like to get a raw Response object use the other deleteShopperContext function.
An object containing the options for this method.
A promise of type void.
Gets the shopper's context based on the shopperJWT.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Gets the shopper's context based on the shopperJWT.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
If you would like to get a raw Response object use the other getShopperContext function.
An object containing the options for this method.
A promise of type ShopperContext.ShopperContext.
Gets the shopper's context based on the shopperJWT.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type ShopperContext.ShopperContext otherwise.
Updates the shopper's context based on the Shopper JWT. If the shopper context exists, it's updated with the patch body. If a custom qualifier/assignment qualifer
or an effectiveDateTime
or a sourceCode
or a customerGroupIds
is already present in the existing shopper context, its value is replaced by the corresponding value from the patch body. If a custom qualifers'
or a assignment qualifiers'
value is set to null
, it's deleted from existing shopper context. If effectiveDateTime
or sourceCode
value is set to an empty string (""), it's deleted from existing shopper context. If effectiveDateTime
or sourceCode
value is set to null
, it's ignored. If an effectiveDateTime
or sourceCode
or custom/assignment qualifiiers'
value is new, it's added to the existing Shopper context. If customerGroupIds
is set to empty array []
the existing value in shopper context is deleted.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
If you would like to get a raw Response object use the other updateShopperContext function.
An object containing the options for this method.
A promise of type ShopperContext.ShopperContext.
Updates the shopper's context based on the Shopper JWT. If the shopper context exists, it's updated with the patch body. If a custom qualifier/assignment qualifer
or an effectiveDateTime
or a sourceCode
or a customerGroupIds
is already present in the existing shopper context, its value is replaced by the corresponding value from the patch body. If a custom qualifers'
or a assignment qualifiers'
value is set to null
, it's deleted from existing shopper context. If effectiveDateTime
or sourceCode
value is set to an empty string (""), it's deleted from existing shopper context. If effectiveDateTime
or sourceCode
value is set to null
, it's ignored. If an effectiveDateTime
or sourceCode
or custom/assignment qualifiiers'
value is new, it's added to the existing Shopper context. If customerGroupIds
is set to empty array []
the existing value in shopper context is deleted.
With B2C Commerce release 24.5, all endpoints in the Shopper context API will require the siteId
parameter for new customers. This field is marked as optional for backward compatibility and will be changed to mandatory tentatively by January 2025.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type ShopperContext.ShopperContext otherwise.
Generated using TypeDoc
Shopper Context
The Shopper Context API enables developers to build highly contextualized shopping experiences for shoppers.
Example with shopper auth
API Version: 0.0.29import { Customer, ClientConfig, Customer, slasHelpers } from "commerce-sdk"; // or const { Customer, ClientConfig, Customer, slasHelpers } = require("commerce-sdk"); const clientConfig: ClientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; // must be registered in SLAS. On server, redirectURI is never called const redirectURI = "http://localhost:3000/callback"; const slasClient = new Customer.ShopperLogin(clientConfig); token = await slasHelpers.loginGuestUser(slasClient, { redirectURI }); clientConfig.headers['authorization'] = `Bearer ${token.access_token}`; const shopperContextClient = new Customer.ShopperContext(clientConfig);
Last Updated: