Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WooCommerce Snippet Zahlungsarten auf ein Land begrenzen
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