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

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