Repository Forums Support WooCommerce Extended Coupon Features PRO BOGO Free Product applied to ALL products in cart

Topic Resolution: Resolved
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1562
    Sebastian Kabis
    Participant

    Dear Team,
    I have an urgent request.
    In my shop the customer should get a free item if he buys at least 5 of the same (so the 6th is free).
    That works fine. But when I add another product in my cart with e.g. just a quantity of 3, then the coupon is also applied and the customer would get a free product of the product as well, although he didn’t buy 5.

    Please see screen:
    shop

    Can you please help me?
    Best
    Sebastian

    #1563
    Sebastian Kabis
    Participant

    If the screen doesn’t work: http://schlossgut.mtwtesting.de/shop.jpg

    #1564
    Soft79
    Keymaster

    Tick ‘allow multiplication’ and use this snippet in functions.php (replace COUPON_CODE_HERE with the actual coupon code:

    
    add_filter( 'wjecf_bogo_product_amount_for_coupon', 'wjecf_bogo_product_amount_for_coupon', 10, 2 );
    
    function wjecf_bogo_product_amount_for_coupon( $amount, $coupon ) {
      if ( $coupon->code == 'COUPON_CODE_HERE' ) {
        $amount = floor($amount / 5);
      }
      return $amount;
    }
    
    #1565
    Sebastian Kabis
    Participant

    Thank you – functions.php of my theme? Or where do I find this thile?

    #1566
    Soft79
    Keymaster

    Yes, preferably in your child theme.

    #1567
    Sebastian Kabis
    Participant

    Works like a charme! THANKS so much!

    #1568
    Soft79
    Keymaster

    Great!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.