Untitled
unknown
plain_text
3 years ago
524 B
12
Indexable
add_filter( 'woocommerce_available_payment_gateways', 'nabik_gateway_disable_for_shipping_rate' );
function nabik_gateway_disable_for_shipping_rate( $available_gateways ) {
if ( ! is_admin() ) {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = $chosen_methods[0];
if ( isset( $available_gateways['cod'] ) && 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
unset( $available_gateways['cod'] );
}
}
return $available_gateways;
}Editor is loading...