Using the Salesforce B2C Commerce APIs, you can search for all qualifying/discounted products that are associated with a one or more product promotion and show them in one place on the storefront, giving customers more information and choices to help make better buying decisions.
For example, a storefront home page shows a promotion teaser "Buy 3 Shirts Get 1 Free". When the customer clicks the teaser, a list of all the qualifying shirts appears. Shirts that are sold out are not included on the list. The customer can then refine the list by brand and sort the list by price. An example of refining search results by multiple promotions, is to filter search results to return products that qualify for either a 20% discount or a free bonus item.
The APIs for Get promotion products are based on storefront search and can therefore be combined with other search refinements such as category, price, brand, and color.
You can programmatically refine by multiple promotions using the following:
Search
pipelet to pass in
a promotion ID value.dw.catalog.ProductSearchModel
B2C Commerce Script API to pass in a
promotion ID value.Search URL
(in the Search
pipeline) for a search result refined by multiple promotions.The promotion ID is consumed by the Search pipelet and the
search result contains only products for both promotions. To refine your
search by multiple promotions via, use the promotionID
parameter to enter a list of promotion IDs, separated by |, for example,
10%OFF|20%OFF.
The following
dw.catalog.ProductSearchModel
methods support this
feature:
Method | Description |
---|---|
getProducts() : String
|
Returns the products in the search results. |
getPromotionID() : String
|
Returns the promotion with the specified ID. |
setPromotionIDs(List promotionIDs) :
String
|
Specifies multiple promotion ids used for the search query. Supports up to 30 promotion IDs. |
When using the Search URL sub-pipeline, the value of the URL
parameter pmid
contains a list of promotion IDs separated
by |, for example:
.../search?prefn1=color&prefv1=red|green &pmid=10%OFF|FREE_BONUS
Promotions can have qualifying or discounted products, or both. In many cases, qualifying and discounted products are the same. For the various combinations of promotion types and discount types, products of a promotion are returned by these APIs as follows:
Promotion type | Discount type | Products returned |
---|---|---|
Without qualifying products With amount of qualifying products With number of qualifying products |
Percent Off Amount Off Fixed Price Percent Off Product OptionsPrice From Price Book Fixed Price Shipping Free Shipping |
Discounted products/options |
Buy X For Total |
n/a |
Discounted products |
Buy X Get Y |
Percent Off Amount Off Fixed Price Price From Price Book Free |
Qualifying and discounted products |
Without qualifying products With amount of qualifying products With number of qualifying products |
Bonus Products Choice Of Bonus Products |
Qualifying products |
To use this feature, you must set the promotion to searchable in Business manager. B2C Commerce considers a product promotion to be searchable if its Searchable flag is set to True and if it's active at any time 20 days in the past, any time 20 days in the future, or is currently active in the context of a campaign or A/B test.
When you create a new promotion or update the product rule of an existing promotion, you must perform a full rebuild of the product search index to include the updated promotion details. When the customer searches for a product in the storefront, and B2C Commerce executes a specific promotion ID, B2C Commerce looks for products that have this promotion ID incorporated into their index documents.
Promotion price and price book conditions are evaluated based on the price books assigned to the site at index time. Price books assigned to a session programmatically during run time are not considered.
This is a storefront implementation example:
The Search pipeline
supports the pmid
(promotion ID) parameter. You can use
this in your application to show a promotion within a content
asset.
Create a content asset (or edit an existing one) to contain a promotion search link as follows:
/Search-Show?pmid=40off-womenfootwear-selected on the image Save Up To 40% On Select Women's Footwear Styles.