Created
June 4, 2015 10:24
-
-
Save ajitbohra/b3dec6fdf060cde68f04 to your computer and use it in GitHub Desktop.
WooCommerce Removing payment gateway based on country
This file contains 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 | |
// 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