Duplicate Line Item gets added on Applying discount

Vote:
 

Extension Method in EPiServer.Commerce.Order.IOrderGroupExtensions

ApplyDiscounts(this IOrderGroup orderGroup, IPromotionEngine promotionEngine, PromotionEngineSettings settings);

When this method is called on order object it is adding duplicate line item and removing the other line items. This is the case only when If you have created a Discount/Promotion and has Product in the `This discount does not apply to these catalog items` list. Then if you have that product addedf in cart along with other products in that case above specified method add's duplicate line item.

Example:- Suppose you have Product A in excluded list and Product A and Product B in cart then on Applying discount you will have two products and both will be Product A.

Because of this we are getting an exception of duplicate line item. I guess it should not have added duplicacy and either provide error or apply discount only to Product B as per example case.

#284519
Jul 27, 2022 12:03
Vote:
 

Hi Sandeep,

What are the details of the promotion being applied?

#284736
Aug 01, 2022 8:17
Vote:
 

Hello Sandeep, 
Have you customized promotion that you are applying? Couple of things to check - 
1. You don't have multiple promotions active for the same item and same amount if any threshold is limited. This will conflict and not a valid case.
2. Check for promotion processor if you have it customized. 


#284751
Aug 01, 2022 12:17
Vote:
 

Hi Surjit and Manoj,
First of all thanks for your response.
I have created a Campaign and in that have two discounts
   1. Item Discount (20% off) : 20% off on particular category items, it is applied automatically
   2. Order Discount (Spend100) : 10% discount on spend of 100, it is applied with promotion code

I have not customized promotion and there's no limits set.

#284813
Aug 02, 2022 10:07
- Aug 04, 2022 11:09
Just a wild guess if you can swap the priorities of both the promotions if that makes any differences?
Sandeep Singh Shekhawat - Aug 29, 2022 11:47
Hi Manoj, although I have not set priorities explicitly but even when there's only one discount in Campaign it works the same.
- Aug 29, 2022 13:05
Sandeep, Can you check with Foundation solution whether configuring same promotion behaves the same? Can you also try updating commerce if that helps. I think if the error is reoccurring in foundation solution then this is a bug with the version you are using.
* 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.