Repository Forums Support WooCommerce Extended Coupon Features PRO BOGO coupon 3 + 1 extra | 6 + 2 extra ??

Topic Resolution: Resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Mascha Beekmans 2 weeks, 3 days ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8597

    Mascha Beekmans
    Participant

    We have a furniture webshop where we have a promotion 3 + 1 chair for free. I was able to create this with the plugin. But if the user orders 6 chairs he should get 2 free chairs and so on….

    If I check the multiplication box he will add 3 + 3 for free.

    How can I solve this?
    3 chairs = 1 free
    6 chairs = 2 free
    9 chairs = 3 free
    etc…

    #8599

    Soft79
    Keymaster

    Instead of using BOGO, use the Free Product option, and set minimum quantity of matching products to: 3

    #8600

    Mascha Beekmans
    Participant

    seems to me a good solution however, there are several chairs that have this action. So I can’t select 1 free product.

    If I order three chairs “x” then I get 1 chair “x” for free.
    But I can also order 3 chairs “y” and then you get 1 chair “y” for free.

    See attach

    #8623

    Soft79
    Keymaster

    Then you need to paste this snippet in your child theme. Replace the 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 ( strcasecmp( $coupon->get_code(), 'COUPON_CODE_HERE' ) == 0 ) {
        $min_matching_product_qty = intval( 
        $coupon->get_meta( '_wjecf_min_matching_product_qty' ) );
        if ( $min_matching_product_qty < 1 ) $min_matching_product_qty = 1;
    
        $amount = floor($amount / $min_matching_product_qty );
      }
      return $amount;
    }
    
    #8630

    Mascha Beekmans
    Participant

    Ok Thx, we will try this snippet 😉

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.