Skip to content

Instantly share code, notes, and snippets.

@ajitbohra
Created June 4, 2015 10:24
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 ajitbohra/b3dec6fdf060cde68f04 to your computer and use it in GitHub Desktop.
Save ajitbohra/b3dec6fdf060cde68f04 to your computer and use it in GitHub Desktop.
WooCommerce Removing payment gateway based on country
<?php
// Reomve unsupported payment gateway
function payment_gateway_disable_for_country( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['instamojo'] ) && $woocommerce->customer->get_country() != 'IN' ) {
unset( $available_gateways['instamojo'] );
}
return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_for_country' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment