Buy X Add Y Products not being added


  • Default avatar
    matthew51    
     6 months ago
    0

    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 3.6.0.10.

    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:

    $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 );

    I'm not sure if this is the best solution but it has made the extension work for us now.

    Hopefully this helps somebody else.
  • Your avatar
    seyi    
     6 months ago
    0

    Hello,

    Thanks for reporting.  I have done some tests and will make sure it is fixed on the next update of AwoCoupon.
  • Default avatar
    yaniv2    
     a month ago
    0

    Hi,

    I am experiencing the same issue with AwoCoupon 3.6.0.12 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
  • Your avatar
    seyi    
     a month ago
    0

    The above code already exists in 3.6.0.12 so that is not the issue.  There must be something else causing it.  Happy to look more into it if you can send a private message with temp admin / ftp access and exact instructions how to reproduce.
  • Default avatar
    yaniv2    
     24 days ago
    0

    Ok, found the problem, it was in the cart module that i use,
    thanks
    yaniv