Repository Forums Support WooCommerce Extended Coupon Features PRO Buy 1 Get 1 with 3 items Max in 1 Purchase

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16942
    valentin
    Participant

    Hi Soft79, can you provide me a code snippet for the Buy One Get One which limit the Buy 1 Get 1 product on the 4th item?
    Example: The customer can’t avail the 4th BOGO in one purchase but the 1, 2, & 3rd item will avail the BOGO. So, if the customer purchase 4 items, it will view on the Cart 4[items] & [3 Free items]

    How can this be done on BOGO option or in a snippet?
    Thank you.

    #16949
    Soft79
    Keymaster

    Tick the box ‘Allow multiplication of the free products’ and BOGO and use this snippet:

    
    add_filters( 'wjecf_bogo_product_amount_for_coupon', function( $qty, $coupon ) {
        if ( strcasecmp( $coupon->get_code(), 'THE_COUPON_CODE' ) === 0 ) {
            $qty -= floor( $qty / 4 );
        }
        return $qty;
    }, 10, 2 );
    

    Note: replace THE_COUPON_CODE with the actual coupon-code. Untested.

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