Repository Forums Support WooCommerce Extended Coupon Features PRO How to add 2 free products of the same SKU

Topic Resolution: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4269
    javamandk
    Participant

    Hi

    I have a problem finding a way to add 2 free produkts (SAME SKU) on one coupon.

    Have I overlooked how to do this?

    Best
    Allan

    #4270
    Soft79
    Keymaster

    Unfortunately you need to add a snippet to your CHILD THEME’s functions.php for that:

    
    add_filter( 'wjecf_free_product_amount_for_coupon', function ( $amount, $coupon ) {
        if ( 0 === strcasecmp( $coupon->get_code(), 'THE_COUPON_CODE' ) ) $amount = 2;
        return $amount;
    }, 10, 2 );
    

    Replace THE_COUPON_CODE by the actual coupon code.

    I plan to make this possible out-of-the-box in a future version of the plugin; it has been requested multiple times.

    #4271
    javamandk
    Participant

    Hi

    It works fine, thanks..

    And I’m looking forward for that upldate 🙂

    Best
    Allan

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