Created
July 28, 2018 19:17
-
-
Save WPprodigy/5c541f215755f7507e3a5847f65050ad to your computer and use it in GitHub Desktop.
Hide "Cash on Delivery" on the order-pay page, and hide "PayPal Standard" on the main checkout page.
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
<?php | |
/** | |
* Hide "Cash on Delivery" on the order-pay page, and hide PayPal on the main checkout page. | |
*/ | |
function wc_ninja_conditional_gateways_for_order_pay( $available_gateways ) { | |
if ( is_wc_endpoint_url( 'order-pay' ) ) { | |
unset( $available_gateways['cod'] ); | |
} else { | |
unset( $available_gateways['paypal'] ); | |
} | |
return $available_gateways; | |
} | |
add_filter( 'woocommerce_available_payment_gateways', 'wc_ninja_conditional_gateways_for_order_pay' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment