嗨所以我有这个网站了。 allsocks.com.ng并且我们正在努力使货到付款仅适用于基本州的订单。我想知道我是否可以编辑答案here以适应。
如果是,那我该怎么编辑? 感谢
答案 0 :(得分:0)
试试这个
function change_payment_gateway( $gateways ){
$included_states = array( 'AK','HI','GU','PR' ); // add your state here
// Compare cart subtotal (without shipment fees)
if(in_array( WC()->customer->shipping_state, $included_states ) ){
}
else{
// then unset the 'cod' key (cod is the unique id of COD Gateway)
unset( $gateways['cod'] );
}
return $gateways;
}