Created
June 12, 2013 13:35
-
-
Save denishvachhani/5765289 to your computer and use it in GitHub Desktop.
Disable/Hide Certain Payment method like ( cod, paypal, etc..) for certain 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 | |
// Note for %payment-code% | |
// CashonDeliver = 'cod' | |
// PayPal = 'paypal' | |
// Basic Payment = 'bacs' | |
// Cheque payment = 'cheque' | |
// Mijireh Gatway = 'mijireh_checkout' | |
// Note for %countrycode% | |
// India = 'IN' | |
// Norway = 'NO' etc... | |
function payment_gateway_disable_country( $available_gateways ) { | |
global $woocommerce; | |
if ( isset( $available_gateways['%payment-code%'] ) && $woocommerce->customer->get_country() <> '%contrycode%' ) { | |
unset( $available_gateways['%payment-code%'] ); | |
} | |
return $available_gateways; | |
} | |
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_country' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment