Why coupon auto loads the lower value at cart?

  • Posts: 567
  • Thank you received: 11
2 months 1 week ago #363908

-- HikaShop version -- : 5.0.4
-- Joomla version -- : 4.4.4
-- PHP version -- : 7.3.33
-- Browser(s) name and version -- : Chrome

I have 2 products, same price.

Product One is set for RM20 discount (min qty 2).
Product Two is set for RM25 discount (min qty 2).

But why is RM20 coupon discount auto-loaded instead?

If i remember correctly, the cart autoloads the higher value coupon. Is that not so?

Attachments:
Last edit: 2 months 1 week ago by ler@singmuiheng.com.

Please Log in or Create an account to join the conversation.

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
2 months 1 week ago #363909

Hi,

In general that is the case. But saying that is a simplification of what really happens behind the scenes.
In practice, knowing which autoloaded coupon has the bigger value is difficult. That's because you can either configure the coupon with a fixed amount or a percentage. And then system cannot efficiently calculate the real value of the coupons before comparing them as that would require calculating the value for each auto loaded coupon before running the comparison algorithm.
So, to make it easier, the system compare the coupons first based on their "order value from" and if it is the same value, the "product quantity from" value. Usually, either of them is set differently and it works fine.
In your case, you didn't set any "order value from" and set the "product quantity from" to the same value of "2". So there is no real ordering and the system picks up the first one it finds.

So, this means two things can be done:
- on your end, you could set the value of the coupon in the "order value from" and it would work like you want.
- on our end, we could add the coupon flat value as a last determining factor for the sorting so that in your case, it would properly select the correct coupon. We'll look at adding this on our end for the next version of HikaShop.

The following user(s) said Thank You: ler@singmuiheng.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum