You are here:
Order Management Web Store Records for B2C Commerce
Both the Even Exchange and the Order on Behalf Of flows require users to select a web store record that represents their B2C Commerce storefront. Order Management creates the required web store records for you. These system-generated web store records set the LocationType to Virtual. If you want to control the location or change other fields, you can create your own web store records.
If your store supports multiple currencies, create a web store record for each possible combination of currency and locale that can appear in order data.
An order’s currency code and locale ID are matched with the web store IsoCurrencyCode and DefaultLanguage fields, respectively. Thus, in Business Manager Site Settings, you can select only locales that match valid values for the web store DefaultLanguage. You can’t select “default.” For details about supported languages, see WebStore in the Object Reference for Salesforce and Lightning Platform.
To create a web store record, you must be assigned the Operations Manager permission set. You can’t create a web store with the required values in the Salesforce UI, so use a tool like Postman or Apex code. Define these properties.
- Name: Any unique name
- CurrencyIsoCode: Required for storefronts that support multiple currencies. This value matches the currency code in order data.
- DefaultLanguage: Required for storefronts that support multiple languages. This value matches the locale ID in order data.
- DefaultTaxLocaleType: NET or GROSS
- ExternalReference: Use the format instanceId + @ + siteId. For example, abc_123@SiteGenesis
- LocationId: Optional. If you don’t specify a location, the system creates a location and sets this value to its ID. In that case, it sets the new location’s LocationType field to Virtual and its ExternalReference field to null. If you include any custom validations for the Location object, they must account for these values.
- SupportedCurrencies: Required for storefronts that support multiple currencies. Include only one value, which must match CurrencyIsoCode.
- SupportedLanguages: Required for storefronts that support multiple languages. Include only one value, which must match DefaultLanguage.
- Type: B2CE
Here’s an Apex code example for creating a web store.
WebStore createWebStore( String name, String instanceId, String siteId ) {
WebStore store = new WebStore(
Name = name,
// Either NET or GROSS
DefaultTaxLocaleType = 'NET',
// Format expected is instanceId@siteId; example abc_123@SiteGenesis
// If multicurrency is enabled then uncomment these lines:
//CurrencyIsoCode = 'USD',
//DefaultLanguage = 'en_US',
//SupportedCurrencies = 'USD',
//SupportedLanguages 'en_US',
ExternalReference = instanceId + '@' + siteId,
Type = 'B2CE');
return store;
}
WebStore webStoreRecord = createWebStore('Apex1 WebStore', 'abc_123', 'SiteGenesis');
insert webStoreRecord;
Here’s a multicurrency example. Let’s say that you have one site that supports US orders in US dollars. A second site supports UK orders in pounds or euros, and also supports French orders in euros. Create four web stores with these values.
| Name | ExternalReference | CurrencyIsoCode | DefaultLanguage | DefaultTaxLocaleType | SupportedCurrencies | SupportedLanguages | Type |
|---|---|---|---|---|---|---|---|
| SiteGenesis USD | abc_123@SiteGenesis | USD | en_US | NET | USD | en_US | B2CE |
| SiteGenesisGlobal GBP en | abc_123@SiteGenesisGlobal | GBP | en_GB | GROSS | GBP | en_GB | B2CE |
| SiteGenesisGlobal EUR fr | abc_123@SiteGenesisGlobal | EUR | fr_FR | GROSS | EUR | fr_FR | B2CE |
| SiteGenesisGlobal EUR en | abc_123@SiteGenesisGlobal | EUR | en_GB | GROSS | EUR | en_GB | B2CE |

