Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › how to select 2 free products on products with 2 quantity › Reply To: how to select 2 free products on products with 2 quantity
December 7, 2018 at 12:33 pm
#4386
Soft79
Keymaster
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. This snippet fixes the allowed amount of free products for the coupon to two. You need to set Min quantity of matching items of the coupon to 2 as well.