Skip to content

Instantly share code, notes, and snippets.

@billrobbins
Created May 29, 2019 14:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save billrobbins/468e0c3aa2575db57074dccf9bd2175e to your computer and use it in GitHub Desktop.
// 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