Try our conversational search powered by Generative AI!

How find product has eligible for discount or not?


commerce ver:10.2.5


we have using epi discount type "buy x products get discount on all".How can I get product has eligible to get discount to display the offer in the product listing. We have using epi find for search.

Advance Thanks,

Edited, Jun 06, 2018 14:51

You could run the promotion engine with an in memory cart with only the product as a lineitem when indexing, and index different values depending on which rewards you get. It will definately make the indexing slower, since you need to run the promotion engine once per product.

Jun 06, 2018 15:10

Hi Joel,

I am using " promotionEngine.Evaluate(new List<ContentReference> { variationLink })" but I am getting an error, anything missing?

stack trace

at EPiServer.Commerce.Marketing.Internal.PromotionEngineContentLoader.CreateInMemoryOrderGroup(ContentReference entryLink, IMarket market, Currency marketCurrency)
at EPiServer.Commerce.Marketing.PromotionEngine.Evaluate(IEnumerable`1 entryLinks, IMarket market, Currency currency, RequestFulfillmentStatus requestFulfillmentStatus)
at EPiServer.Commerce.Marketing.IPromotionEngineExtensions.Evaluate(IPromotionEngine promotionEngine, IEnumerable`1 entryLinks, ICurrentMarket currentMarket)
at EPiServer.Commerce.Marketing.IPromotionEngineExtensions.Evaluate(IPromotionEngine promotionEngine, IEnumerable`1 entryLinks)
at SnS.Infrastructure.Services.Implementations.CartService.AddPriceToVariation(String code, Decimal price) in D:\WLC-Phase11\src\SnS\Infrastructure\Services\Implementations\CartService.cs:line 793
at SnS.Infrastructure.Services.Implementations.CartService.AddToCart(LineItemLite item) in D:\WLC-Phase11\src\SnS\Infrastructure\Services\Implementations\CartService.cs:line 560

Edited, Jun 06, 2018 15:25

What is the exception exactly?

Jun 06, 2018 19:17

Null exception I think...

Jun 06, 2018 19:19

Hi Quan,

we are using default market only so I am only passing variation content link for evaluate throws a null exception.

Advance Thank you,

Jun 07, 2018 14:42

Hi quan,

My requirement is to display promotion details on the product listing page. You have offer Like buy10 items & 10%off. So I am using evaluate method like below it works fine(it gives promotion details) when the product is in the promotion category if the product is not in the promotion category it throws null l exception? What is an actual use of an evaluate method.How to solve the exception or how to get promotion details for the product? 


promotionEngine.Evaluate(new List<ContentReference> { variationLink }, market, market.DefaultCurrency, RequestFulfillmentStatus.All);

Edited, Jun 07, 2018 15:16

When you run evaluate you get a list of reward descriptions for each reward found. If no rewards found, it would be an empty list. 

If I were you I'd debug and check the values of the parameters you send it, just verifying that they look okay and that some property that shouldn't be null is null. So check market, marketDefaultCurrency and variationLink.

Jun 07, 2018 15:57

Thank you Joel,

Evaluate works well when the product is in the promotion category but the product not in the promotional category means it will throw a null exception.

Jun 07, 2018 16:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.