Created
November 21, 2014 16:19
-
-
Save lmartins/127b693312b30bed9d7f to your computer and use it in GitHub Desktop.
Disable payment method for certain countries
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
/** | |
* Desabilita pagamento por Transferência para clientes não PT | |
*/ | |
function mw_payment_gateway_disable_country( $available_gateways ) | |
{ | |
global $woocommerce; | |
if ( isset( $available_gateways['bacs'] ) && $woocommerce->customer->get_country() !== 'PT' ) { | |
unset( $available_gateways['bacs'] ); | |
} | |
return $available_gateways; | |
} | |
add_filter( 'woocommerce_available_payment_gateways', 'mw_payment_gateway_disable_country' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment