Created
May 29, 2019 14:20
-
-
Save billrobbins/468e0c3aa2575db57074dccf9bd2175e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function disables the Stripe gateway everywhere except for the order-pay endpoint. | |
// It also removes the Check gateway from the order-pay endpoint. | |
function ijab_selected_gateways_order_pay( $available_gateways ) { | |
if ( is_checkout() && ! is_wc_endpoint_url( 'order-pay' ) ) { | |
unset( $available_gateways[ 'stripe' ] ); | |
} | |
if ( is_checkout() && is_wc_endpoint_url( 'order-pay' ) ) { | |
unset( $available_gateways[ 'cheque' ] ); | |
} | |
return $available_gateways; | |
} | |
add_filter( 'woocommerce_available_payment_gateways', 'ijab_selected_gateways_order_pay' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment