individual use coupon con points and rewards
<?php
if( defined( 'YITH_YWPAR_PREMIUM' ) ) {
add_filter( 'woocommerce_apply_individual_use_coupon', 'yith_points_and_rewards_apply_individual_use_coupon', 10, 3 );
add_filter( 'woocommerce_apply_with_individual_use_coupon', 'yith_points_and_rewards_apply_with_individual_use_coupon', 10, 2 );
function yith_points_and_rewards_apply_individual_use_coupon( $applied, $coupon_code, $coupons )
{
$cart = !empty( WC()->cart ) ? WC()->cart : false;
if( $coupon_code !== 'ywpar_discount' || ( $cart && $cart->has_discount( $coupon_code ) ) ) {
$applied = $coupons;
}
return $applied;
}
function yith_points_and_rewards_apply_with_individual_use_coupon( $skip, $coupon_code )
{
if( $coupon_code->code == 'ywpar_discount' ) {
$skip = true;
}
return $skip;
}
}