Sure I Try first, ad was amazed that no one at WOOC noted that.
For local pick up maybe could be used and is fine but COD is in Italy used for the ‘legacy’ National delivery together with other payment methods like PayPal or Bank Transfer.
If my shop is in Italy COD must disappear if customer purchase from abroad.
Luckily got a solution myself.
/**
* @snippet WooCommerce Disable Payment Gateway for a Specific Country
*/
function payment_gateway_disable_country( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['cod'] ) && $woocommerce->customer->get_country() <> 'IT' ) {
unset( $available_gateways['cod'] );
}
return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_country' );