Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deshabhishek007/46fe86c15c2296a11121cad8452768a0 to your computer and use it in GitHub Desktop.
Save deshabhishek007/46fe86c15c2296a11121cad8452768a0 to your computer and use it in GitHub Desktop.
WooCommerce Snippet to Disable Paypal for Indian Customers.
add_filter( 'woocommerce_available_payment_gateways', 'wpmudra_payment_gateway_disable_country' );
function wpmudra_payment_gateway_disable_country( $available_gateways ) {
if ( is_admin() ) return $available_gateways;
if ( isset( $available_gateways['paypal'] ) && WC()->customer->get_billing_country() == 'IN' ) {
unset( $available_gateways['paypal'] );
}
return $available_gateways;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment