Retrieves configurations for the specified organization and site.
If you would like to get a raw Response object use the other getConfigurations function.
An object containing the options for this method.
A promise of type SiteConfiguration.
Retrieves configurations for the specified organization and site.
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 SiteConfiguration otherwise.
Generated using TypeDoc
Shopper Configurations
*Download API specification
API Overview
The Shopper Configurations API provides cacheable configuration data to shopper-facing applications, enabling them to make decisions based on merchant settings without requiring server-side logic.
This highly cacheable data encompasses toggles, preferences, and configuration information that allows the application to be reactive to changes performed by the merchant, admin, or support engineer.
Configuration types include:
Authentication & Authorization
The Shopper Configuration API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
You must include
sfcc.shopper-configuationsin the client ID used to generate the SLAS token. For a full list of required permissions, see the Authorization Scopes Catalog.For details on how to request a shopper access token from SLAS, see the guest user flows for public clients and private clients in the SLAS guides.
Use Cases
Use Hooks
You can extend the Shopper Configurations response with custom data using the
dw.shop.shopper_configuration.modifyGETResponsehook. This is useful for adding custom site preferences to the response.Example Hook Implementation
exports.modifyGETResponse = function (configResp) { var customPreference = dw.system.Site.getCurrent().getCustomPreferenceValue( "customerServiceEmail" ); configResp.c_customPrefs = { customerServiceEmail: customPreference || "noreply@example.com" }; };For details on hook registration, see Hook Method Details.
Site Identification and Availability
Retrieve the site's display name and current operational status to determine if the storefront is online, offline, or in a maintenance state for shoppers.
Currency Configuration
Identify the default currency for the site and the list of all supported currencies to ensure correct price rendering and multi-currency support.
Locale and Language Settings
Access the default locale and the full set of supported locales to localize content, formatting, and language for the shopper's specific region.
Feature Enablement
View the status of various storefront features and toggles to dynamically enable or disable application logic based on the merchant's active configuration.
Caching
Caching capabilities are available for the Shopper Configuration APIs. For details, see Server-Side Web-Tier Caching.*
Simple example:
API Version: 0.0.33import { ShopperConfigurations } from "commerce-sdk-isomorphic"; const clientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; const shopperConfigurationsClient = new ShopperConfigurations(clientConfig);Last Updated: