Hide payment based on selected shipping method
-
I’ve been trying to find out how to hide certain payment gateway based on selected shipping. I have been working with this code but nothing so far. Any help with this?
add_action( ‘woocommerce_after_checkout_form’,’woocommerce_hide_shipping’ );
function woocommerce_hide_shipping() {
global $woocommerce;$chosen_methods = WC()->session->get( ‘chosen_shipping_methods’ );
$chosen_shipping = $chosen_methods[0];if ($chosen_shipping == ‘table_rate’) {
function payment_gateway_disable_country( $available_gateways ) {
unset( $available_gateways[‘paytrail’] );
return $available_gateways;
}
add_filter( ‘woocommerce_available_payment_gateways’, ‘payment_gateway_disable_country’ );}
}
- The topic ‘Hide payment based on selected shipping method’ is closed to new replies.