Hi,
The way the amount of a coupon is calculated is this:
- restrictions not on the amount and quantity are applied to see if a coupon can be used. If not, the coupon is discarded
- if a coupon is limited to only some products or some categories, then only these products will be taken into account
- the total amount and quantity of the products taken into account is calculated ( for example, if I have 10 products in the cart, but the coupon is restricted to only 5 products, the total amount and quantity is calculated on these 5 products )
- then, the restrictions on the amount and quantity are applied based on the total calculated in the previous step. If not, the coupon is discarded
- the percentage is applied on the total calculated to get the amount of the coupon
Why is it like that ? Well, historically, there was no "max amount" / "max quantity" restrictions on coupons, only minimums. The goal was to motivate users to purchase more on the shop. And so, below the minimums, the coupon would not be accepted. So, when we added the maximum settings, it was logical that they work the same way as the minimums, and above the maximums, the coupon would not be accepted.
So that's the reason why it's like that at the moment.
Is there a way to make it work like you want with the options available ? Not really.
Could it be done ? Sure.
First, you have the cart fees plugin:
www.hikashop.com/marketplace/product/279-cart-fee.html
With it, you can add extra fees to the cart between the subtotal and the total. The fee can have a positive or a negative amount. You can use conditions and formulas. And you can use the {cart.cart_coupon} to add an extra fee to correct the amount of the coupon on the fly.
While the result will do what you want, it's a bit finicky to configure, but at least, not code or modification is required.
Second, HikaShop has a coupon API:
www.hikashop.com/support/documentation/6...entation.html#coupon
So, it is possible to develop a small plugin to implement the calculation of the coupon value the way you want. It requires a bit of development, but with the help of chatGPT, any developer should be able to do it in less than an afternoon.
Third, we could implement something in HikaShop to support what you want.
Now, changing the behavior of the system so that it works like you want by default is out of the question. People already use coupons in the way we implemented it. And have a hard max amount cutoff is important when you configure several coupons with the "auto load in cart if possible" setting activated. That way, you can create a coupon from 0 to 50, another from 50 to 100, another from 100 to 200, etc and adapt the discount value and / or percentage for each range of total amount automatically. Not having a hard cutoff would mean that only one coupon would be taken into account and the others would be ignored.
And changing the default behavior would impact users with that kind of setup when updating their HikaShop.
We could potentially add an extra option. However, the coupon system already has a lot of complex options. I don't feel confortable adding yet another option.
I think that making a small plugin to adapt the behavior on the fly is the way to go here. It's relatively easy to do and won't impact others in any negative way.