In specific conditions previously applied carts rules are set to 0 if a new product ( with associated cart rule ) is added to the order.
It is set to 0 because the order that the cart rules are applied have changed.
The order is defined first by the cart rule priority and by adding's order depending.
PS : It is better to reproduce with real product not the demo one
In the Back office
In the Front office
In the Back office again
Screenshots
https://drive.google.com/file/d/19lPRSkB5PxZpQWlT26aBGksFIDx9xN3z/view?usp=sharing
In 1.7.6.5 it's a little bit different
https://drive.google.com/file/d/13IJlYz4N8UNjNtdxPotH0pqiNvBgjsk1/view?usp=sharing
Thanks for opening this issue! We will help you to keep its state consistent
All right, I am able to reproduce this following the scenario, however when I write Behat tests with the same settings, I have no issues
Such a lovely bug ❤️
Hi @SD1982, after diving into the code, I am now wondering whether this is an issue 😁 .
The reason I say this is because of the following test:
Now from the BO, if you add Product A, the 500EUR discount applies to the order
BUT it seems the "10% discount" is affected by this 500EUR discount, I am not sure why but now it's providing -80EUR discount
And the 3 discounts appear
So I believe that the "discounts are set to zero" strange behavior is because in your scenario, the 500EUR discount makes the order amount reach zero. And when you have an order with total 0 euro, you cannot apply a -10% or -10EUR discount so they are applied as "zero".
The whole topic basically revolves around "in what order should the discounts be applied" ? First the 500EUR discount ? or the 10% ? or the 10EUR ? because if you start with the 500EUR discount, then order becomes "free" so it makes sense other discounts are counted as zero.
Hehe 😁 quite a complex usecase but I think current behavior seems better than 1.7.6.5 .
@SD1982 and @matks If I understand well, the issue remains only in which order the discount are applied to have the wanted discount display.
The response for that IMO is to keep consistency between the FO and the BO.
If I apply the discount in the same order as @SD1982 in FO:
We have the result below
It seems the order of discount application becomes is adding order. The amount from the last discount (associated discount) only displays the amount discountable.
So basically, the order is defined by adding's order depending on the priority.
@SD1982 So, An use case we should check is the priority in the discount setting when they are manually defined by the merchant. Have tried it out already?
During the test, I found this issue on reproducing your steps (if confirmed, I will be transferred to another issue).
If Product Z is ordered without a discount.
And In the BO order page, you add the following discount:
@SD1982 Weird that you did encounter this issue, it might be my PS but could try it out to confirm it ?
The priority is well taken into the calculation and the cart rule works perfectly fine even when cart rule associated doesn't correspond to the maximum amount discountable. So, since the cart rule order should be done by the priority, the issue will be done on the 1.7.8.
Most helpful comment
All right, I am able to reproduce this following the scenario, however when I write Behat tests with the same settings, I have no issues
Such a lovely bug ❤️