Thank you, Nicolas,
Maybe I didn't make my case clear enough in my first post when I said, "... shipping can get added in certain zones ...". So, shipping does not depend on the product price at all but only on zones, and I can't see how then the min/max restrictions could help solving the case and get the coupon math right.
Just for clarification and consideration:
- Product price is always 0 = free.
- Shipping method selection depends on zone the customer is in. So, there are at least two zones, to each of which one shipping method is restricted, one of them is price = 0, the other is price = 20.
I guess the culprit in my case is described in your line
If the sum of the product prices + coupon is below 0, the total is brought back to 0 before the shipping is calculated and added to it.
But how do you explain what's happening in the backend? I had posted the screenshot already, but here it is again, showing that
the coupon value gets somehow "lost"... it's set to 0.00 there:
There seems to be more happening in the system than only the total being brought back to 0 as you say, because only this wouldn't erase the coupon value, or?
Update:
Upon further investigation, I see that for an order entered in the frontend with conditions set as above, in the database the field order_discount_code does contain the coupon name, but the field order_discount_price is 0.00000, strangely. That can't be right, no matter what you said about the condition of "the total brought back to 0"?!
Additionally, if I enter a new order in the backend with same conditions (product price = 0, shipping method/price = 20) and apply a coupon there (it doesn't recognize existing coupons, but I can enter "20" as value), it all goes well, and the math is right, means the total is 0.
And then it's also all saved properly in #__hikashop_order.
This "strange behaviour" with coupon value being saved as 0 when entered in the frontend, plus the math working in the backend, makes me wonder if there is something, or something else, going "wrong" in the system, not depending on the condition to bring the total of product and coupon back to 0.
BTW, I've seen AWOCoupon, but frankly, I find US-$60 a bit steep (to put it mildly) to only get this simple math straight. Aside from that, it would still leave the mystery of the HikaShop coupon value in the database and backend = 0.00, I guess.