Help Wordpress

Blog about WordPress, plugins, themplates and more…
MENU
Home » Plugins » WA Edit States List – free WooCommerce plugin

WA Edit States List – free WooCommerce plugin

WA Edit States List
WA Edit States List – free WooCommerce plugin
5 (100%) 5 votes

Sometimes it becomes necessary to edit the list of U.S. States on the checkout page. The reasons may be different – for example, store owner not want to deliver your goods in the particular States. Or vice versa – store works only with a few specific U.S. States.

How Add/Modify States in WooCommerce? I know three ways, and I will describe each of them. And you yourself choose the best way.

Add/Modify States List in the translation file.

The list of the States located in /wp-content/plugins/woocommerce/i18n/states/US.php file.
However, note that this decision has a significant drawback – if you will update WooCommerce, you will have to edit this file again.

Add/Modify States List via the code snippet.

Just add in the functions.php file of your theme the following code:

add_filter( 'woocommerce_states', 'custom_woocommerce_states' );

function custom_woocommerce_states( $states ) {

  $states['XX'] = array(
    'XX1' => 'State 1', 
    'XX2' => 'State 2'
  );

  return $states;
}

However, note that this solution is also not without drawbacks:
1 – you will update the template, you will have to re-edit the functions.php;
2 – if you decide to change the template, you have to make changes in functions.php;

Add/Modify States List via free WooCommerce plugin.

I wrote a free plugin for woocommerce. It allows you to turn on and off States in U.S. States list.

WA Edit States List

WA Edit States List

 

WA Edit States List

WA Edit States List

1. Upload the plugin files to the /wp-content/plugins/wa-edit-states directory;
2. Activate the plugin through the ‘Plugins’ screen in WordPress;
3. Use the woocommerce > Edit States List screen and enable or disable states;

Download free WooCommerce plugin.

Posted 1 year ago
Category: Plugins
Tags: , ,

If you like this plugin, please click on one of the buttons to share it with your friends. Thank you!

Related posts:

slon-example

SLON Example

SLON Example Reconnecting JavaScript leads to its re-execution, i.e. issue of the site productivity. Also, this can lead to unpleasant side effects – for example, if a given [...]
slon

Enqueue scripts in WP plugins. Single Load Only.

Enqueue scripts in WP plugins. Single Load Only. In this post I want discuss one of the problems with WordPress plugins/themes – reconnecting javascript. Connecting the script several [...]
wordpress-4-8

What’s New in WordPress 4.8

What’s New in WordPress 4.8 WordPress Version 4.8, named “Evans” in honor of jazz pianist and composer William John “Bill” Evans, is available for download or update in [...]
wordpress-4-7

What’s New in WordPress 4.7

What’s New in WordPress 4.7 Version 4.7 of WordPress, named “Vaughan” in honor of legendary jazz vocalist Sarah “Sassy” Vaughan, is available for download or update in your [...]

1 Comment

1 Comment


RSS feed for comments on this post.

Leave a comment


Last Polls: