Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Don’t apply other coupon discounts to a BOGO/Free product › Reply To: Don’t apply other coupon discounts to a BOGO/Free product

#15561
Soft79
Keymaster

No, it must in the $values array. The value is set for every free cart item that was added by a coupon.

This works:


add_filter( 'woocommerce_coupon_is_valid_for_product', function( $valid, $product, $coupon, $values ) {
    if ( isset( $values['_wjecf_free_product_coupon'] ) ) error_log ( $product->get_id() . " is a free item" );
    return $valid;
}, 10, 4 );