You are here:
Assign a Price Book or Promotion to a Specific Store in B2C Commerce
With Store-Specific Pricing and Promotions, select a price book for each of your stores, up to 2,000. The assignments framework lets merchants and developers set qualifiers, such as a store that activates certain experiences, such as a promotion. You can also assign a promotion to a specific store. This feature is only supported via XML import. To use a site assignment, a developer must first edit the assignments XML to include a store assignment. Currently only stores can be listed as assignments.
-
Click App Launcher
, and then select
.
- Click Import in the Assignments section.
- Select the file with your assignments and click Next.
-
Consider the following sample code for assignments.
<?xml version="1.0" encoding="UTF-8"?> <assignments xmlns="http://www.demandware.com/xml/impex/assignment/2020-11-30"> <assignment assignment-id="Storeassignment_A"> <description xml:lang="x-default">Price books and promotions assigned to Store A</description> <description xml:lang="zh-CN">万能青年旅店</description> <enabled-flag>true</enabled-flag> <start-date>2020-11-24T00:00:00.000Z</start-date> <end-date>2025-11-24T00:00:00.000Z</end-date> <assigned-sites> <site>SiteGenesis</site> <site>SiteGenesisGlobal</site> </assigned-sites> <qualifiers match-mode="any"> <qualifier type="STORE">Store A</qualifier> </qualifiers> <experiences> <pricebooks> <pricebook-id>list_pricebook</pricebook-id> <pricebook-id>sale_pricebook</pricebook-id> </pricebooks> <promotions> <promotion-id>20%Off_promotion</promotion-id> </promotions> </experiences> </assignment> </assignments>
See the status of your file. Hit refresh until the import concludes. The import can take a few minutes.
To display store-specific experiences on the storefront, a
developer must update their Salesforce Reference Architecture (SFRA) cartridge or write an Open Commerce API (OCAPI) hook to set the store in
session. To set the store Id in session for SFRA, use the
setStoreIDToSession() method. For example:
StoreMgr.setStoreIDToSession('0335').
In Shopper Commerce API (SCAPI), the qualifier is case-sensitive for createShopperContext and updateShopperContext depending on however you’ve set the qualifier type in the XML. For example:
{
"assignmentQualifiers": {
"STORE": "0335"
}
}
See Also
- Configure Promotion Preferences for B2C Commerce
- Promotion Schedules in B2C Commerce
- Tiered Discounts in B2C Commerce
- B2C Commerce Promotion Compatibility
- Maximum Application for B2C Commerce Promotions
- Specify Who Qualifies for an Experience in B2C Commerce
- Qualifying and Discounted Products in B2C Commerce
- Promotion Restrictions to Identical Products
- Qualify or Disqualify Promotions Based on Active Price Book

