The situation:
Type of goods on 3000, into database there a coupon, valid from 3000, enter this coupon. After that, reduce the number of goods. The purchase amount is less, but the coupon is not removed.
Solution:
In the function checkoutData() of the class VirtueMartCart when you change the goods in the cart the coupon will not be checked. To ensure that the coupon was checked before
if (!empty($this->couponCode)) {
insert
if (empty($this->couponCode) && !empty(self::$_cart->cartData["couponCode"])) {
$this->couponCode = self::$_cart->cartData["couponCode"];
}
and in the redirect
if (!empty($redirectMsg)) {
$this->couponCode = '';
$this->_inCheckOut = false;
$this->setCartIntoSession();
//doesn't work the first time
//return $this->redirecter('index.php?option=com_virtuemart&view=cart'.$layoutName , $redirectMsg);
//its work
JFactory::getApplication()->redirect('index.php?option=com_virtuemart&view=cart'.$layoutName , $redirectMsg);
}
The modified file can provide.
UP
Which version of VM do you use?
VirtueMart 3.0.10