Lets say we have a order with 2 products for 749 each adding up to 1498 plus a delivery cost of 49. The user then adds a campaign code with 1500 in discount. The overlapping amount of 2 from the campaign code then goes towards the delivery cost which ends up being 47 instead of 49 which also lowers the VAT for the delivery.
Is that as intended or is it a bug?
If it’s not a bug which calculator should I override to fix this in the best way ?
IVatCalculator has the method CalculateTotalDeliveryVat that you could look at depending on what you want to do.
And if that does not answer your question, what is the grand total of your order after the discount and how does that differ from your expected grand total?
Well the original question was. Should a campaign of type “lower ordervalue with x amount” actually lower the delivery cost if the campaign amount is bigger than the total value of the order? I feel it shouldn’t and before I start overriding and experementing I would like to know if thats intended or not.
This is by design. The order discount is given on the total order, and the delivery cost is treated as part of it.
The actual calculation is done in the order discount campaign action, and it looks at the order grand total, not excluding the delivery costs.
If you instead wants to discount only the order row totals, you would need to write a action that operates only on row totals.
Note that, the action does not have any idea of what conditions enables a campaign as per current design of campaign engine.