Skip to content

Instantly share code, notes, and snippets.

@sholsinger
Created February 23, 2021 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sholsinger/302b6b991ab34153adb193a4817ee403 to your computer and use it in GitHub Desktop.
Save sholsinger/302b6b991ab34153adb193a4817ee403 to your computer and use it in GitHub Desktop.
Automating SFCC B2C Pricebook Site Assignment

Assigning a Pricebook to a Site Automatically

The list of pricebooks that should be active is saved in a system-level Site Preference called, SitePriceBooks. This value can be set by importing a preferences.xml file in a site import/export archive. The value of this site preference should be a colon (:) separated list of pricebook IDs. eg:

<preference preference-id="SitePriceBooks">list-prices:sale-prices</preference>

The entire file should look like the following code snippet:

<?xml version="1.0" encoding="UTF-8"?>
<preferences xmlns="http://www.demandware.com/xml/impex/preferences/2007-03-31">
    <standard-preferences>
        <all-instances>
          <preference preference-id="SitePriceBooks">list-prices:sale-prices</preference>
        </all-instances>
    </standard-preferences>
</preferences>

This file must be placed in a folder structure as shown below:

siteImport/
 ∟ sites/
  ∟ <siteID>/
   ∟ preferences.xml

Where <siteID> is replaced with the ID of your site, for example: RefApp. This folder structure would then be zipped using a command like:

zip -r siteImport.zip siteImport

Note: The folder and the resulting zip file name must be identically named. This zip file can be uploaded to WebDAV on SFCC instances and imported using the ImportSiteArchive system job step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment