API: Storefront Search for Products Eligible for Promotion

You can use the Salesforce B2C Commerce API to search for all products that are eligible for a promotion, whether they are qualifying or discounted. You can search for qualifying products only, discounted products only, or both.

The input parameter, PromotionProductType, used in the Search pipelet and the ProductSearchModel scripting class, enables you to perform this level of search.

Note: For the Search pipelet, the same product can be returned by all three types of search. This behavior is different than the API methods PromotionPlan.getProductPromotionsForQualifyingProduct(Product) and getProductPromotionsForDiscountedProduct(Product), which never return the same promotion for a given product.

The products returned by this type of product search depend on the class of the promotion and other aspects of its configuration. The rules are listed below.

All Promotion Types

For all promotion types, the promotion must be marked as searchable if you want to search for products using that promotion. A product isn't returned by a product search if it's globally excluded, and the individual promotion doesn't disable global product exclusions.

There are additional rules, as follows, by promotion class:

Product Promotions

For product promotions, a search for qualifying or discounted products returns a product if that product satisfies the qualifying or discounted product rule, respectively.

Order Promotions

For order promotions:

Shipping Promotions

For shipping promotions:

Important: You must rebuild the product index for this feature to take effect. Because only promotions marked as searchable are included, if you don't want the behavior to occur, you should explicitly mark all shipping and order promotions as not searchable. In general, if you don't use this feature in the storefront, it's better to mark promotions as not searchable, because setting them to searchable will increases indexing time.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.