Prices and promotions in SFCC
Salesforce B2C Commerce (SFCC) manages pricing and promotions using price books and a promotions engine. The Algolia cartridge can index price and promotion data and display them on the storefront. The cartridge supports two modes for fetching pricing and promotion data:- Indexing prices and promotions. Price and promotion data is indexed in Algolia and fetched with search results. The pricing information reflects the data at the time of indexing.
- Lazy loading prices and promotions. Price and promotion data is fetched asynchronously from SFCC when search results are displayed, ensuring the most up-to-date information, including dynamic promotions.
Price books
Price books define the base prices of products. A price book is a collection of product price definitions for a specific currency. SFCC allows multiple price books, which you can assign to sites. Price books can be arranged in a hierarchy, allowing for price inheritance.Promotions engine
The promotions engine lets you create promotional campaigns that offer discounts or special offers to users. Promotions can be available to specific users, coupons, or under certain conditions, such as user segments or session-based promotions like βBuy One Get One Free.β You need to manage these promotions with the SFCC promotions engine. Promotions can apply various types of discounts, including percentage off, fixed amount off, or free shipping.Algolia displays product-level promotions in search results but not order-level or shipping-level promotions because they depend on the session context.
Index price and promotion data with the Algolia cartridge
The Algolia cartridge lets you index price and promotion data with jobs so you can display accurate pricing and promotional information in your search results.Indexing capabilities
What you can index
- Sale prices from price books: Index the sale prices of products from the active price books.
- Promotional prices: Index promotional prices calculated from active promotions applicable to all users.
- Promotions: Include information about promotions that are active or will be active in the next 30 days, such as promotion IDs and prices.
price
: the base price of the product from the price book.promotionalPrice
: the lowest promotional price of the product from active promotions.promotions
: an object containing promotional prices and promotion IDs.pricebooks
: an object containing prices from different price books mapped by their IDs.
JSON
Configure indexed attributes
To index promotions and promotional prices:- In Business Manager, go to Merchant Tools > Algolia > Algolia.
- In Additional Product Attributes, add
promotionalPrice
andpromotions
.
productAttributesConfig.js
file in the int_algolia/cartridge/configuration/
directory to define how attributes are fetched and mapped.
For more details, see configurable attributes.
Display pricing and promotions on the storefront
Displaying pricing
The Algolia SFRA cartridge (int_algolia_sfra
) provides default templates and JavaScript code to display price and promotion information in search results with the following priority:
- Display of promotional prices: If a product has a promotional price, the original price displays with a strike-through, and the promotional price appears nearby.
- Display of list price: If a product has a list price, the list price displays with a strike-through, and the sales price appears near it.
- Display of sale price: The sale price is displayed as the default price.
Displaying promotions
The cartridge displays promotions that are active and applicable to the product:- Price promotions: Promotions affecting the productβs price display as promotional prices.
- Call-out messages: Promotional messages like β20% offβ or βBuy One Get One Freeβ appear on product tiles.
#algolia-activePromos
HTML element.
When the page loads, the cartridge calculates which promotions are active for each user and injects them into the search results.
Then, the JavaScript code displays the prices and call-out messages accordingly.
Enable prices lazy loading
To enable prices lazy loading:- Go to Merchant Tools > Algolia > Algolia in Business Manager.
- Select Enable prices lazy loading.
Limitations
- Sorting and faceting: Sorting and faceting on promotional prices and lazy loading are not supported. The sales price in the index is used for sorting and faceting.
Implement in SiteGenesis
and PWA Kit
- SiteGenesis: Promotions and Lazy Loading features are not supported in
SiteGenesis
. Customize the behavior similarly to SFRA by modifying the corresponding files. - PWA Kit: Promotions and Lazy Loading features are not supported in PWA Kit. You need to implement custom logic to fetch pricing or promotional prices from SFCC.
Additional considerations
- Performance implications: Enabling pricing lazy loading provides the most accurate and up-to-date pricing information, but it causes some extra load on the server and delay when fetching pricing information.
- Customization: You can customize how pricing and promotions are displayed by modifying the templates and JavaScript in the
int_algolia_sfra
cartridge. For example, you can change the styling of price displays or how call-out messages are presented.