Mark - Can you confirm you are creating an Item discount or order discount? Are you creating your own custom discount type?
An Order level discount is on the basket total. So you don't have to worry about how much discount for each item.
Hi Naveed, as above in my original post, this is an "Order" discount. This is not a custom discount type. Once the discount is applied and the cart converted to a purchase order, you can query the LineItem table in the Commerce DB. In here you will see two columns, "LineItemDiscountAmount" and "OrderLevelDiscountAmount". OrderLevelDiscountAmount is set to 6.666666667
Cheers
Mark
Mark - That's the default behaviour. By default, the order promotion will give an equal discount of 6.666666667 per line item.
If you want to give discount like
Lineitem 1: $6.66
Lineitem 2: $6.66
Lineitem 3: $6.68
you need to create a Custom promotion type.
Hi Naveed,
Yes I understand that is the default behaviour, so my question is how I can change that behaviour? I don't really see how implementing a custom promotion type will help, as even with a custom promotion type the discount still needs to be applied to the lineitem and I would think that is in this application of the discount to the lineitem where customisation needs to occur. Can you provide any further detail on how you think this can be achieved? Code example?
Cheers
Mark
Hi Mark,
Sounds like you want a mix of entry and order level discounts applied to the cart from a single promotion.
Would creating a custom PromotionProcessor help? Usually you'd create a custom PromotionData and then create a new PromotionProcessor either inheriting from entry, order or shipping derived classes. You may be able to achieve your example by deriving from PromotionProcessorBase itself. Have a look at RewardDescriptions as a property of this class. You may be able to mix both entry and order discounts here after you've worked out the correct values.
https://world.episerver.com/csclasslibraries/commerce/EPiServer.Commerce.Marketing.PromotionProcessorBase-1?version=13
Definately just order discount, we have entry discount as well, however in this case I wouldn't want them mixed, all I want to do is work out the remained of the discount value that hasn't been attributed to a lineitem and then attribute this. i.e. in my example where all lineitems have OrderLevelDiscountAmount set to 6.66, I would work out the remainder as 0.02 and then sum this with the existing value and set against the lineitem so it becomes 6.68
6.66 + 6.66 + 6.66 = 19.98
20.00 - 19.98 = 0.02 (Remainder)
Lineitem 1: 6.66
Lineitem 2: 6.66
Lineitem 3: 6.66 + 0.02 = 6.68
6.66 + 6.66 + 6.68 = 20.00
I'll look into the PromotionProcessor further, I've implemented that in the past for somehtign different, so not sure if this is the right way, but I'll investigate further.
Cheers
Mark
Hi Guys,
We are using the latest version of Commerce (13.29.0).
My question is best described with an example. Say we have three lineitems and a coupon is applyied to the order resulting in an order level discount of $20. The discount is apportioned across all three lineitems, however there is a remainder as the $20 can't be evenly apportioned across the 3. My client would like us to get the remaining discount and add this to the final lineitems order level discount amount. So say the apportioned order level discount value was $6.66 for each lineitem, the final lineitem value would be updated to $6.68
Lineitem 1: $6.66
Lineitem 2: $6.66
Lineitem 3: $6.68
I think this needs to occur in the DiscountUpdater, however this seems not to be interceptable. Is there a way to achieve this? I don't believe I can implement in a custom calculator, i.e. OrderGroupCalculator, as I won't have access to the discount object, so I won't actually know the reward I need to ensure all lineitem order level discount values sum to. This is especially true, when the reward is a percentage rather than just a dollar value.
Cheers
Mark