Untitled
unknown
plain_text
2 years ago
524 B
8
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...