Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wooexperte/f0582f5a83e84e38cfa532f2b38002b5 to your computer and use it in GitHub Desktop.
Save wooexperte/f0582f5a83e84e38cfa532f2b38002b5 to your computer and use it in GitHub Desktop.
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