Nicola Mustone

Happiness Lead @ Automattic



Ban Russia From the Checkout in WooCommerce

yellow and black caution tape

The Russian invasion of Ukraine of February 2022 is currently affecting everyone in the world, most of all Ukrainian people, of course.

As individuals, there’s not much that we can do other than donating to the cause and helping those in need.

If you are a shop owner currently selling to Russia and want to align with the sanctions of NATO and all the other countries, in your small reality, you can ban Russia from your WooCommerce store.

How can you do that? Let me explain!

If you are selling to specific countries only and Russia is one of them, you can remove it by going to WooCommerce > Settings > General > General options > Selling location(s) > Select – Sell to Specific Countries.

If you are selling to all countries, you can ban Russia from the list on your Checkout page with a PHP snippet. Add this code to your wp-content/themes/your-child-theme/functions.php file:

<?php
add_filter( 'woocommerce_countries_allowed_countries', 'wc_ban_russia' );
function wc_ban_russia( $countries ) {
if ( isset( $countries['RU'] ) ) {
unset( $countries['RU'] );
}
return $countries;
}
view raw functions.php hosted with ❤ by GitHub

It might not seem much, but every little bit helps towards stopping this war against innocent people.

Advertisements

Subscribe to This Blog

Receive new articles from this blog directly in your inbox! No spam guaranteed!

Join 651 other subscribers

Contribute to Improving This Blog

Did you enjoy this article? Was it helpful? Contribute to help me write more articles! The funds collected from this blog are reinvested directly into improving my skills or the blog so that I can provide more and better content!

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

€5.00
€15.00
€100.00
€5.00
€15.00
€100.00
€5.00
€15.00
€100.00

Or enter a custom amount


Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly
Advertisements

More Posts That You Might Like…


Leave a Reply

Advertisements

Categories

Newsletter

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Join 651 other subscribers

About The Author

Hi, I’m Nico! Support Lead at Automattic, championing WordPress.com & WooCommerce. Off-duty, I’m at Elemental Beacon, leading epic D&D adventures. Let’s connect, whether it’s about WordPress or a quest!

Advertisements

Don't Miss a Thing!

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Join 651 other subscribers

Continue Reading

%d bloggers like this: