Closed jedateach closed 10 years ago
I've built in a few restrictions to prevent negative sales, but still need to solve the issue at hand.
I have restructured the way that discounts are applied to an order:
@chillu any chance that you or one of the team could peer review this fix at some stage? c2f97add80c164e2690340d328ff4c48169caa10
When the discount is greater than the total, you get negative order totals.
If you have two+ cart total discounts they may both be applied to the subtotal, and therefore add up to greater than the subtotal. This is a motivation to switch to cart-level discounts actually applying to individual items. Or another approach is to apply cart level discounts to whatever is left after item discounts have been applied?
See Calculator.php https://github.com/burnbright/silverstripe-shop-discount/blob/master/code/Calculator.php#L31
If orders get through with this bug, then it may turn out that discounts are counted because they are linked to the order, yet the total discounted amount will still be greater than the order value.