Configure dynamic pricing
Leave how to configure dynamic procing.
Use dynamic pricing to maintain a price book in SFCC (Salesforce Commerce Cloud) in a base currency and have it converted to configured target currencies. You can create a checkout experience that lets customers select their shopping country as well as the currency. They can then conduct a transaction and be presented with converted prices. Use dynamic pricing to also apply country-specific tax rates to the storefront prices.
Dynamic pricing best practices
Keep in mind the following when configuring and enabling dynamic pricing installation:
With dynamic pricing enabled, the merchant must ensure that the country selected from the country and currency menu is used as the shipping country in checkout and that the customer cannot change the shipping country.
Important: The merchant needs to provide customization to enforce this requirement.
Dynamic pricing jobs do not convert amount-based promotions. To use amount-based promotions, create them in the desired amounts per currency.
Since dynamic pricing uses a job to convert prices, changes to the base price book are not reflected in real time. Updated prices are converted the next time the scheduled job runs.
The dynamic pricing job for Product Options updates prices on a per-catalog basis. If the catalog is shared between sites with different taxation structure net/gross for the same currency, one of the sites will have inaccurate prices. The taxation structure (net/gross) configured on the Digital River side will determine the correct prices for a given country/currency combination.
The dynamic pricing job for Product Options updates prices on a per catalog basis; if multiple countries using the same currency are configured, some of the countries may get incorrect prices. This is due to the SFCC limitation that product options are stored in the catalog (not the price book) and can only store prices per currency, not per currency/country combinations. By default, the connector uses the first applicable country/currency combination for each currency as configured in Business Manager in the Configure Supported Country Currency Pairs module. See the Configure supported Country and Currency pairs section of the User Guide section for more details.
Configuring dynamic pricing
Complete the following steps to configure dynamic pricing:
1. Configure site and global configuration options
When using dynamic pricing, you can choose multiple configuration options. To set these options, do the following:
Select BM Merchant Tools and select Site Preferences.
Select Custom Preferences to see Custom Site Preferences Groups.
Click Digital River to see the cartridge setup fields.
At the site level, provide the following preference information when using dynamic pricing.
Digital River Enable Dynamic Pricing: Enable or Disable the dynamic pricing feature.
Digital River Shipping Method Availability: Select one of the following:
Native SFCC methods only (native): Choose this option to disable the Digital River Shipping Options feature
DR Shipping Quotes methods only (quotes): Choose this option to display only Digital River Shipping Options
Native SFCC and DR Shipping Quotes methods (both): Choose this option to display both Digital River shipping options and native SFCC shipping methods.
Digital River List Converted Price Book Naming: Provide the naming pattern of list price books generated by the dynamic pricing job. The naming convention must contain the {COUNTRY} and {CURRENCY} placeholder tokens; otherwise, the price books will not be generated.
Digital River Sale Converted Price Book Naming: Provide the naming pattern of sale price books generated by the dynamic pricing job. The naming convention must contain the {COUNTRY} and {CURRENCY} placeholder tokens; otherwise, the price books will not be generated.
Digital River Batch Size – Specify the number of items to send in the Dynamic Pricing API call. The default number is 50. However, this setting has been tested against batches of 500 and 1000 or more. You should test and optimize the batch size based on the resource allocation of the SFCC instance.
Provide the following global-level preference information:
Digital River Base Currency Code: This code instructs the DigitalRiver_DynamicPricing_ProductOptions job about which of the existing currencies will be used as the base currency for product option conversion.
2. Enable all currencies
Merchants must enable all required currencies on the site(s) to use the dynamic pricing feature. In addition, they should add the locale and currency combinations to the alternativeCurrencyCodes property in thecountries.json
file for your site(s). The countries.json file
must be present on the cartridge path for both the storefront(s) and the Business Manager. If this file is not present, you will not be able to configure country currency pairs.
3. Configure Supported Country Currency Pairs business manager module
In addition to custom site preferences, you can configure dynamic pricing with an additional method in the form of a Business Manager (BM) Module extension. Use this extension to let the merchant configure country and currency mapping. This mapping is used by dynamic pricing jobs to generate prices and is used on the storefront to create the country and currency selection form. The information is saved in a hidden site preference as JSON. See the Merchant Tools section of the User Guide for more details on using this module.
Tip: Before using the Dynamic Pricing feature, you must configure supported country currencies and run the Dynamic Pricing job to generate the price books.
4. Configure the Dynamic Pricing jobs
Refer to the Configure jobs section for information on configuring dynamic pricing jobs.
5. Add the country currency selector modal to your storefront in the desired location.
Add the country currency selector modal to your storefront in the desired location. Do this as described in this document's Menu template and Page Header template sections.
Note: The cartridge does not automatically override these templates so it must be added in the desired location. Alternatively, instead of using the country currency selector provided in the cartridge, you can create a custom selector.
Configure jobs
You can use two different jobs for price conversion with dynamic pricing:
DigitalRiver_DynamicPricing: Converts price books
DigitalRiver_DynamicPricing_ProductOptions: Converts catalog product options.
Use DigitalRiver_DynamicPricing
Use this job to take a base list price book and a base sale price book in the base currency and convert it to target currencies as configured in the Supported Country Currency Pairs module.
The job is made up of several flows that include the following:
Flow 1
Scope: Organization
This flow exports the price books and uses the SFCC built-in ExportPriceBook
. You must configure two parallel steps for both the list price book and the sale price book.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value but it's best to describe the actual job action. For example, ExportListPriceBook and ExportSalePriceBook.
Description: Provide additional information that describes the job step. This field is optional.
PriceBookID: Specify the ID of the list base price book (ExportLIstPriceBook step) and sale price book (ExportSalePriceBook step). This field is required.
Note: You must update this parameter with the ID(s) of your price book(s).
ExportFile: Specify the path and name of the exported file relative to
IMPEX/src
. If you change the default value, update the corresponding value in the ProcessPriceBooks step. This field is required.FileNamePrefix: Leave this blank. This field is optional.
OverwriteExportFile: Enable this setting. When enabled, this action overrides a file with the same name if it exists.
Always execute on restart: Leave this setting disabled as it controls behavior on restarting this job.
Flow 2
Scope: Site
This flow processes the exported price books and generates new dynamic pricing price books. This flow can be configured in 2 ways:
Single-step: With this configuration, you can generate all the price books for country and currency pairs. Set the scope to include all sites using the dynamic pricing feature.
Parallel steps (2 versions):
Parallel steps (country-based): Each step generates the price books of 1 country. You must configure the country parameter to use this method and configure one step for processing each country. You may be required to set up multiple flows to support all desired countries.
Parallel steps (site-based): Configure parallel steps with each scope set to a single site if you have multiple sites in your instance. Configure a step per site.
Note: By default, the job is configured with a single step for this flow. Modify the job to support various configurations as just described.
Note: Choose whether to use single or parallel steps based on your environment. Test your environments to determine which setup optimizes the performance of your price book conversions. While parallel processing has many benefits, your instance is constrained by its resource allocation and can only use the available resources when running parallel steps.
This flow uses Custom.DigitalRiverProcessPriceBooks
custom job step. Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value, but it's best to describe the actual job action. For example, ProcessPriceBooks or ProcessPriceBooksUS.
Description: Provide additional information that describes the job step. This field is optional.
BaseListPriceBookPath: Specify the path and name configured in the previous flow for the List Price book.
BaseSalePriceBookPath: Specify the path and name configured in the previous flow for the Sale Price book.
DynamicPricingExportFolder: Specify the path of the generated files relative to
IMPEX/src
where files are stored. This is a required field.CountryCode: Specify the country code belonging to the country to be processed. This field is required if the parallel steps configuration (country based) of this flow is used. Otherwise, leave it empty.
Always execute on restart: Leave this setting disabled as it controls behavior on the restarting of this job.
Flow 3
Scope: Organization
This flow imports the price books generated by Flow 2 and makes use of the SFCC built-in ImportPriceBook
job step.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value but it's best to describe the actual job action. For example, ImportPricebooks.
Description: Provide additional information that describes the job step. This field is optional.
WorkingFolder: Specify the path of the generated files relative to
IMPEX/src
where files are stored. This is a required field.FileNamePattern: Leave this field empty.
NoFilesFoundHandling: Set this to NO_FILES_FOULD
ImportMode – Set to merge. This is a required field.
ImportFailedHandling –Set to warn. This is a required field.
AfterImportFileHandling – Set to archive. This is a required field.
ArchiveFolder - Set to archive. This is a required field.
Always execute on restart: Leave this setting disabled as it controls behavior on the restarting of this job.
Flow 4
Scope: All sites
This flow provides reindexing and is required for a new process to be correctly displayed. This flow makes use of the SFCC built-in ReindexProducts
.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value, but it's best to describe the actual job action. For example, ReindexProducts.
Description: Provide additional information that describes the job step. This field is optional.
Product related search indexes – Enable this field as it causes the product index to update. This is a required field.
Active data search index, Content search index: Leave this disabled.
Indexer Type: Specify the type of reindexing. The incremental choice is faster. However, a full index can resolve indexing issues. The setting for this field is for the merchant to decide.
Always execute on restart: Leave this setting disabled as it controls behavior on restarting this job.
Examples of single-step and parallel steps configurations
The following examples show screenshots of both the single-step and parallel steps flow configurations used to export price books and generate new dynamic pricing price books.
This example shows a single-step configuration used to process all currencies:
This example shows a parallel steps configuration used to process different currencies:
Use DigitalRiver_DynamicPricing_ProductOptions
Use this job to take product options in the catalog(s) that use the configured base currency and convert them to the target currencies. Note: This job only supports a single price per currency and not country currency pairs. This is an SFCC limitation.
The job is made up of several flows that include the following:
Flow 1
Scope: Organization
This flow exports the catalog and makes use of the SFCC built-in ExportCatalog
. Configure multiple parallel steps if multiple catalogs are to be updated.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value, but it's best to describe the actual job action. For example, ExportElectronics-m-catalog.
Description: Provide additional information that describes the job step. This field is optional.
CatalogID: Specify the ID of the catalog you are exporting. This field is required.
Note: You must update this parameter with the ID(s) of your catalog(s).
ExportProductOptions: Make sure this is Enabled. This causes the export of product options. This field is required.
ExportCategories, ExportCategoryAssignments, ExportProducts, ExportRecommendations, ExportVariationAttributes: Leave these disabled.
ExportFile: Specify the path and name of the exported file relative to
IMPEX/src
If you change the default value, update the corresponding value in the ProcessProductOptions step. This is a required field.FileNamePrefix: Leave this blank. This is an optional field.
OverwriteExportFile: Make sure this is enabled. This overwrites the file if a file with the same name exists.
Always execute on restart: Leave this setting disabled as it controls behavior on restarting this job.
Flow 2
Scope: Organization
This flow processes the export catalogs and generates the new catalog. You can configure multiple parallel steps if multiple catalogs need to be updated. The flow makes use of the custom job step Custom.DigitalRiverProcessProductOptions
.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value, but it's best to describe the actual job action. For example, ProcessProductOptionsElectronics-m-catalog.
Description: Provide additional information that describes the job step. This field is optional.
BaseCatalogPath: Specify the path and name of the exported file relative to
IMPEX/src
. This should match the path configured in the previous flow. This field is required.ExportFolderPath: Specify the path of the new catalog relative to
IMPEX/src
. If you change the default value, be sure to update the corresponding value in the ImportCatalog step. This field is required.
Flow 3
Scope: Organization
This flow is responsible for importing the price books generated by Flow 2 and uses the SFCC built-in ImportCatalog
.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value but it's best to describe the actual job action. For example, ImportCatalogs
Description: Provide additional information that describes the job step. This field is optional.
WorkingFolder: Specify the path of the generated files relative to
IMPEX/src
where the files are stored. This should match the path configured in the previous flow. This field is required.FileNamePattern: Leave this field empty.
NoFilesFoundHandling: Set to NO_FILES_FOULD
ImportMode: Set to merge. This is a required field.
ImportFailedHandling: Set to warn. This is a required field.
AfterImportFileHandling: Set to archive. This is a required field.ArchiveFolder: Set to archive. This is a required field.
Always execute on restart: Leave this setting disabled as it controls behavior on restarting this job.
Flow 4
Scope: All sites
This flow reindexes and is required for a new process to be displayed correctly. It uses the SFCC built-in ReindexProducts
.
Set the following configuration parameters for this job step:
ID: Specify a unique job step ID. Provide any value, but it's best to describe the actual job action. For example, ReindexProducts.
Description: Provide additional information that describes the job step. This field is optional.
Product related search indexes: Enable this field as it causes the product index to update. This is a required field.
Active data search index, Content search index: Leave this disabled.
Indexer Type: Specify the type of reindexing. The incremental choice is faster. However, a complete index can resolve indexing issues. The setting for this field is for the merchant to decide.
Always execute on restart: Leave this setting disabled as it controls behavior on restarting this job.
Example of a DigitalRiver_DynamicPricing_ProductOptions configuration
The following shows an example of a DigitalRiver_DynamicPricing_ProductOptions configuration:
You can schedule all jobs to whatever frequency the merchant wishes. Be careful not to overlap running jobs with each other or with themselves. A full reindex can take a long time, depending on the number of products. Jobs check for configuration prerequisites first and will fail with an error if these are not met.
Dynamic pricing and storefront functionality
Dynamic pricing functionality is shown to the shopper as a modal that lets them select a country and currency. You must add this selector to the storefront using the Menu template and Page Header .
Dynamic pricing uses the following controller endpoints:
DigitalRiver-CountryCurrencySelector: Retrieves information about the selector.
DigitalRiver-SelectCountryCurrency: Sets the selected country currency and switches price books.
You can customize the user interface of the selector as long as you use the endpoint correctly. The expected parameters for setting the country and currency are country
and currency
.
Extending the Country/Currency Selector
You can use a custom country currency selector instead of using the one provided by the cartridge. Make your user interface call the DigitalRiver-SelectCountryCurrency controller the same way the .js script provided in the cartridge does.
An example of this can be found in the cartridge in the drDynamicPricingSelector.js
script. For example:
Pass the following parameters into the Ajax call
country
: Set to the shopper-selected country that will be used for dynamic pricing.currency
: Set to the shopper-selected currency that will be used for dynamic pricing.action
: Use as a passthrough as part of the redirect URL.queryString
: Use as a passthrough as part of the redirect URL.
Last updated