In WooCommerce, I'm trying to remove "Cash on delivery" payment method when cart subtotal is up to $250 for specific shipping zones names (Zone 1, Zone 4 and Zone 7).
All others zones must not have this restriction.
Here is my incomplete code based on this thread:
add_filter( 'woocommerce_available_payment_gateways', 'change_payment_gateway', 20, 1);
function change_payment_gateway( $gateways ){
$zone = $shipping_zone->get_zone_name();
if( WC()->cart->subtotal > 250 ) && if($zone=='Zone 1','Zone 4','Zone 7'){
unset( $gateways['cod'] );
}
return $gateways;
}
Any help is appreciated.