to add the Points and Rewards discount also id the option "Disable with other coupon" of Dynamic Discount is active:
<?php
if ( function_exists( 'YITH_WC_Points_Rewards_Redemption' ) ) {
add_filter( 'ywdpd_disable_with_other_coupon', 'ywdpd_disable_with_other_coupon' );
function ywdpd_disable_with_other_coupon() {
if ( ! WC()->cart ) {
return false;
}
$cart_coupons = yit_get_applied_coupons( WC()->cart );
foreach ( $cart_coupons as $coupon ) {
if ( YITH_WC_Points_Rewards_Redemption()->check_coupon_is_ywpar( $coupon ) !== false ) {
return true;
}
}
}
if ( ! function_exists( 'yit_get_applied_coupons' ) ) {
function yit_get_applied_coupons( $cart ) {
if ( version_compare( WC()->version, '3.2.0', '>=' ) ) {
$coupons = array();
$coupons_id = $cart->get_applied_coupons();
if ( $coupons_id ) {
foreach ( $coupons_id as $coupon_code ) {
$coupons[] = new WC_Coupon( $coupon_code );
}
}
} else {
$coupons = $cart->coupon;
}
return $coupons;
}
}
}