Disable COD when coupon is used
-
Hi,
I have used following codes to restrict COD in case of coupon usage. But its not working. I have tried a lot but not getting through. Please can someone guide what is wrong.if( ! empty( $woocommerce->cart->applied_coupons ) ) {
$is_cod_available = false;
}and
add_filter( ‘wc_smart_cod_available’, ‘cod_restrict_coupons’ );
function cod_restrict_coupons( $is_cod_available ) {
global $woocommerce;
$applied_coupons = $woocommerce->cart->applied_coupons;// add the coupon codes you want
// to restrict in this array$restricted_coupons = array(
‘STARTUP’);
if( array_intersect( $restricted_coupons, $applied_coupons ) ) {
$is_cod_available = false;
}return $is_cod_available;
}
- The topic ‘Disable COD when coupon is used’ is closed to new replies.