Last active
January 9, 2019 08:22
-
-
Save wooexperte/f0582f5a83e84e38cfa532f2b38002b5 to your computer and use it in GitHub Desktop.
WooCommerce Snippet Zahlungsarten auf ein Land begrenzen
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
function payment_gateway_disable_country( $available_gateways ) { | |
global $woocommerce; | |
if ( is_admin() ) return; | |
if ( isset( $available_gateways['cash_on_delivery'] ) && $woocommerce->customer->get_billing_country() <> 'DE' ) // Ländercode und Zahlungs ID anpassen | |
{ | |
unset( $available_gateways['cash_on_delivery'] ); // Zahlungs ID anpassen | |
} | |
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