Untitled
unknown
plain_text
a year ago
805 B
3
Indexable
function custom_payment_gateway_disable( $available_gateways ) { // Check if we are on the checkout page but not on the order-pay page if ( is_checkout() && !is_wc_endpoint_url( 'order-pay' ) ) { foreach ( $available_gateways as $gateway_key => $gateway ) { if ( $gateway_key != 'b2bking-invoice-gateway' ) { unset( $available_gateways[ $gateway_key ] ); } } } // Check if we are on the order-pay page if ( is_wc_endpoint_url( 'order-pay' ) ) { if ( isset( $available_gateways['b2bking-invoice-gateway'] ) ) { unset( $available_gateways['b2bking-invoice-gateway'] ); } } return $available_gateways; } add_filter( 'woocommerce_available_payment_gateways', 'custom_payment_gateway_disable' );
Editor is loading...
Leave a Comment