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.
What are the details of the promotion being applied?
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.
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 codeI have not customized promotion and there's no limits set.
Here is the screenshot of the exception
It is very difficult to understand the flow of you application. However I have seen behaviour simialr to this before. Here are some things to check.
Hopefully that helps with you investigation. If you are really stuck I would reach out to Optimizely support who will be able to assit further. It is always useful if you have a demo they can refer to so try to set something up and explain the steps to reproduce.