Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function payment_gateway_disable_country( $available_gateways ) {
- global $woocommerce;
- if ( is_admin() ) return;
- if ( isset( $available_gateways['authorize'] ) && $woocommerce->customer->get_billing_country() <> 'US' ) {
- unset( $available_gateways['authorize'] );
- } else if ( isset( $available_gateways['paypal'] ) && $woocommerce->customer->get_billing_country() == 'US' ) {
- unset( $available_gateways['paypal'] );
- }
- return $available_gateways;
- }
- add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_country' );
Add Comment
Please, Sign In to add comment