Try our conversational search powered by Generative AI!

GetDiscountPrices method does not return results if a Promotion code value is present



I am using Commerce 12.15, I have a scenario where I want to see all the applicable promotions and I use GetDiscountPrices method.

var discountedPrice = ServiceLocator.Current.GetInstance<IPromotionEngine>().GetDiscountPrices(entry.ContentLink, currentMarket, new Currency("USD"));

I am facing an issue where the method returns a 0 count if the promotion has a promo code text. It returns the count correctly, if the promotion does have a promo code text.

Below are two example screen casts: (Promotion code field is blank) (Promotion code field is not blank)

I am expecting the GetDiscountPrices method to return all applicable promotions, and that doesnt seem to be the case if the promotion code field is not blank.

Edited, Apr 03, 2019 23:55

That is the expected behavior, GetDiscountedPrice returns promotions that can be applied for an individual item with quantity = 1, and without any promotional codes (coupons). If you want to get applicable promotions with coupon, you can create an ordergroup, add that item to it as line item and add coupons to that order form, then run IPromotionEngine.Evaluate

Apr 04, 2019 5:16

Thanks Quan!

Apr 04, 2019 14:25
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.