Woocommerce exclude states – free plugin

Sometimes becomes necessary to exclude some U.S. states on the Woocommerce checkout page. The reasons may be different – for example store owner not want to deliver goods in the particular states. Or in another case it can be conversely – such as the store works only with a few specific U.S. states. In this article I will demonstrate few simple ways do it: via code snippets or via my free plugin (WooCommerce Exclude States).
So, how add/exclude U.S. states in WooCommerce? Presently I know about three ways. In this article will describe each of them, and you yourself will choose the best way.

Exclude U.S. states in WooCommerce via translation file

The list of the U.S. states located in /wp-content/plugins/woocommerce/i18n/states/US.php file.
But this decision has a significant drawback. From time to time you need update WooCommerce and after update, you will must to edit this file again.

Exclude U.S. states in WooCommerce via functions.php

If you dont like too much plugins on your site and on condition that you know PHP, this way without a doubt will be the best. Just add in the functions.php file of your theme the following code snippet:

Without a doubt, this solution is also have drawbacks:
1 – when you will update the template, you will need to re-edit the functions.php;
2 – if you decide to change the template, you have to make accordingly changes in functions.php of new template;

Woocommerce exclude states, free plugin

Given these points, I create a simple free plugin for Woocommerce. It allows you to add and exclude U.S. states. And compared to first and second ways, dont need any changes after update WooCommerce or your WordPress theme.

1. Upload the plugin files to the /wp-content/plugins/woocommerce-exclude-states directory;
2. Activate the plugin through the ‘Plugins’ screen in WordPress;
3. Use the WooCommerce -> Edit U.S. states menu and enable or disable U.S. states;

As you can be seen on screenshots bellow, the plugin very easy to use, but if you have any questions you can ask in comments.

Most important Changes in this version:

1 – Of course, it full compatibility with current version of WordPress and WooCommerce;
2 – Hooks for events (update/reset buttons);

All changes you can see in readme.txt (section Changelog).

Woocommerce exclude states: download last version. Also you can download my other plugins or hired me for create specific plugin on Upwork. And as has been noted, any questions or any ideas – welcome to comments.