Buy X Add Y Products not being added
- We noticed on our Virtuemart site that the promotion we had setup where you purchased 2 of one item and got a different one free, which was setup as an Auto Coupon, wasn't being applied automatically. If you manually added the item that should be free then the coupon appeared. I'm sure this used to be working on the site and I'm not sure exactly when it stopped working. We are running Virtuemart 4.0.22 10864 on Joomla 3.10.11 with AwoCoupon 184.108.40.206.I worked through the code and eventually found the Virtuemart Cart object is requiring the quantity to be set in Post data for an item to be added to the cart so the call from awocoupon was failing. I have corrected this by adding the quantity into the vRequest before the call to add to cart in class-awocoupon-helper-estore-virtuemart-discount.php about line 2097 as follows:I'm not sure if this is the best solution but it has made the extension work for us now.$error_msg = '';vRequest::setVar('quantity', array(1)); //Auto products weren't being added without a quantity set$status = $cart->add( array( $product_id ), $error_msg );Hopefully this helps somebody else.
I am experiencing the same issue with AwoCoupon 220.127.116.11 and Virtuemart 4.2.4.
All has been working great for years, and suddenly, when I updated to Virtuemart 4 and AwoCoupon, the functionality of automatically adding the 'Get Y' product (Auto Coupon) stops when adding to the cart. If I manually add the item that should be free, then the coupon appears okay.
I have tried adding the code in 'class-awocoupon-helper-estore-virtuemart-discount.php' as instructed, but with no success.Thanks, Yaniv