VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: visitmontaione on September 02, 2023, 10:31:14 AM

Title: Bug with coupon code and cart update
Post by: visitmontaione on September 02, 2023, 10:31:14 AM
Joomla version 4.3.4
VirtueMart 4.0.12 10777

I have created a coupon with these conditions:
- 10% discount
. Minimum order € 200

You can reproduce the bug in the cart as follow;

https://www.visitmontaione.com/joomla4/it/shop coupon = VMONT23

1- place in the cart goods for more than € 200 to activate the coupon. For example € 300
2- enter the coupon and save, you will see the discount is calculated € 300 + 10% = € 270
3- now, decrease the order less than € 200, let's say at € 140
4- Update the cart
5- you can see now that the coupon is still active and calculated € 140 - 10% = € 126

I have to say that if you proceed the purchase, at the last step the discount is removed.
However, when you update the cart for an amount lower than the minimum for the coupon and the discount is still there, a customer can believe that the discount is still valid.

Do you think it is possible to cancel the coupon on cart update if the amount is less than the minimum for the coupon?

Thanks and kind regards
Title: Re: Bug with coupon code and cart update
Post by: hazael on September 02, 2023, 10:48:26 AM
Similarly, you can see a product with a 30% discount on a page that is cached on the server.
The customer may also happily think that he has a discount, but if he adds this product to the basket, there will only be big sadness   :'(
Title: Re: Bug with coupon code and cart update
Post by: jenkinhill on September 02, 2023, 13:07:31 PM
Have you checked this with VM4.2 ?
Title: Re: Bug with coupon code and cart update
Post by: visitmontaione on September 02, 2023, 14:47:57 PM
Quote from: jenkinhill on September 02, 2023, 13:07:31 PM
Have you checked this with VM4.2 ?

Not jet, I will set a staging site and test it. Than I will post the results here.
Title: Re: Bug with coupon code and cart update
Post by: visitmontaione on September 03, 2023, 12:03:59 PM
Tried with VirtueMart 4.2.0 10905 but nothing change.

If I decrease the quantity of products to make the order lower than € 200,00 (the limit for activate the coupon) the discount is still calculated.

See screenshot.
Title: Re: Bug with coupon code and cart update
Post by: hazael on September 04, 2023, 22:59:42 PM
I don't see a problem there. This is easily solved with simple JavaScript.
Make a javascript function to detect the unique CSS class or ID where the discount appears. With this function, activate a script that will reload the page each time you press the button to remove the product from the cart.
The page after refreshing in the browser will display the actual prices in the cart.
Title: Re: Bug with coupon code and cart update
Post by: Milbo on September 05, 2023, 18:11:37 PM
Hazael, the cart is doing that already. The problem is that there is no check if the coupon is already set.