Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › 2 CONDITIONS 1 COUPON › Reply To: 2 CONDITIONS 1 COUPON

#17038
Soft79
Keymaster

Configure the coupon so it applies both products. Try this snippet (untested):


add_filters( 'wjecf_free_products_to_apply_for_coupon', function( $selected_free_products, $coupon ) {
    if ( strcasecmp( $coupon->get_code(), 'COUPON_CODE' ) === 0 ) { 
        $subtotal = WJECF_API()->get_subtotal_of_matching_products( $coupon ); 
        if ( $subtotal < 200 ) {
            unset( $selected_free_products[1243] );
        }
    }
    return $selected_free_products;
}, 10, 2 );