Coupon minimum order value not working as expected

  • Posts: 100
  • Thank you received: 1
9 years 4 months ago #206728

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4

Hi,

I have created a coupon with the code 10OFF, please see screenshot 'couponConfiguration' attached for the full configuration.

The minimum order value is set to 29.99 but if I add 1 product to the cart with a value of £26.99 I can successfully apply the coupon, please see screenshot 'couponError1' attached.

However, if I increase the minimum order value to £300 the coupon cannot be applied, please see screenshot 'couponError2' attached.

Please note - the website is in offline mode so I will need to supply you log in credentials if you wish to check the issue.

Thanks in advance
Alex

Attachments:
Last edit: 9 years 4 months ago by reders.

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

  • Posts: 12953
  • Thank you received: 1778
9 years 4 months ago #206793

Hello Alex,
Does it works if you change the value of the "Apply discounts" option via "Hikashop->System->Configuration->Main" ?

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

  • Posts: 100
  • Thank you received: 1
9 years 4 months ago #206886

Hi, Thanks for your quick response.

That did the trick.

Thank you
Alex

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

  • Posts: 100
  • Thank you received: 1
9 years 4 months ago #207249

Hello,

Its seems my response was to quick the bug is still happening.

What else can I do to fix this?

Thanks
Alex

Last edit: 9 years 4 months ago by reders.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 4 months ago #207393

Hi,

Can you please remove the "category" restriction on your coupon ?
It might not be related but I don't see the interest to "waste" some processing to filter the products if you want to include all products.

The management of the setting "discount_minimum_order" is made in the class "discount" (administrator/component/com_hikashop/classes/discount).
In that file you can find the function "check" ; in that function please replace

$total_amount = 0;
if(!empty($coupon->products)) {
	foreach($coupon->products as $product) {
		$total_amount += @$product->prices[0]->$var;
	}
}
By
$total_amount = 0;
if(!empty($coupon->products)) {
	foreach($coupon->products as $product) {
		if($product->cart_product_quantity > 0)
			$total_amount += @$product->prices[0]->$var;
	}
}
So we will be sure that the main product won't be also include in the total amount.
You are adding a variant and both of your variant and his main product have price.

That patch will be include in the next release.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: reders

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

  • Posts: 100
  • Thank you received: 1
9 years 4 months ago #207457

Hi Jerome,

That has worked, thank you for your reply.

Good support as always!

Thanks
Alex

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

Time to create page: 0.067 seconds
Powered by Kunena Forum