Negative values in cart critical error

It seems when there is a negative value in the cart it throws an error instead of just completing the order. For example, I have an item that is £37.50 and a discount/voucher code of £40.00. The discount is applied and it is negative -£2.50. The transaction won’t complete, instead it throws an error. See screenshots.

Should it not just complete the order as it does if it is a 0 total? Is there a way to work around this. I believe it should allow negative values in the totals and still complete should it not or am I wrong on that?

Thanks



Commerce will allow the order to complete for free, but only if the total is exactly 0. A negative amount is unexpected behavior - it doesn’t currently, but it’s not a far stretch for Commerce to interpret that as if a refund is due.

I’d suggest rethinking the way your coupon is set up. If it’s a fixed discount, consider adding a minimum order value that matches that discount. If it’s a “free product”-type discount, use the 100% discount option instead of the fixed price, and restricting it to the applicable products.

Hi Mark, thanks for getting back to me. Unfortunately I can’t do that as these are like vouchers which are then used for courses. It doesn’t often happen (28 times last year) but people do add a voucher over the amount and then once used the plan was to reduce the voucher by the amount used and set it with the difference so it can be used again. How can I make it treat negative totals as 0 or as if a refund is due? It basically just needs to complete and the rest will be done manually. What would I need to change? Thanks

What you’re asking for is not possible with Commerce out of the box. Coupons are simply not meant to be used in the way you’re using them. Not what I’d want to tell you, but in the current situation that’s just not going to work.

The current coupon handling is already way too complex as-is, so I don’t see this behavior being avoided automatically by limiting the coupon value that’s applied in a short-term release. I’d rather focus that energy on implementing an actual “vouchers” functionality much better suited to this type of use case.

One (very big) maybe on how to avoid it currently is to set up a “Manual” payment method for orders up to 0.01 that customers can use to complete a negative transaction (any other method will balk at the negative amount). I’ve not tested it, but that might work…