Loading...
Area: Episerver Commerce
Applies to versions: 10.1.0 and higher
Other versions:

Excluding products from promotions

Recommendations [hide]

This topic explains how to configure filters to exclude a product from the promotion engine. Two APIs are available to do this.

Excluding catalog items on all promotions

Use this code to ignore catalog items when evaluating promotions and applying discounts. For example, while promotions on sneakers may be enacted from time to time, you never want the Faded Glory Mens Canvas Slip-On Shoe to receive a discount or to be included in discount-related events (such as Buy at least X items...Get the following discount).

To exclude a product from the promotion engine, implement the IEntryFilter. In most cases, you can use the EntryFilterSettings class to configure the default implementation. If that does not meet your needs, create your own IEntryFilter implementation.

The default implementation of IEntryFilter uses the EntryFilterSettings class to implement the Filter method. If using that implementation, you only need to add filters to the instance of EntryFilterSettings. The following example illustrates various ways to configure the settings.

Examples

Add filters when a site is initialized. 

Note: If you want the filters to work on the front end and the back end site, you must configure them on both sites.

Excluding catalog items from a promotion (New in 13.0.0)

To exclude catalog entries from a single promotion, set the promotion's ExcludedCatalogItems property to a list of ContentReference.

promotion.ExcludedCatalogItems  = new List<ContentReference>() { catalogLink, categoryLink, productLink };

Use ContentReferences to specify catalogs, categories, and entries. If you reference a catalog or a category, the exclusion is recursive, that is, all of its descendants are affected.

If you want to change the default way to exclude catalog items, implement the IPromotionExcludedCatalogItemService interface then register it in one of your initialization modules.

Note: Merchandisers can also exclude catalogs, categories, and catalog entries from a specific discount via the Marketing area's > Edit Discount screen.

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Mar 25, 2019

Recommendations [hide]