This code enables you to exclude states from the drop down menu on the checkout page for any country in WooCommerce. You can :
- Exclude shipping to specific states in America
- Restrict shipping to only 1 or more states in Australia
- Remove states from the billing and shipping drop down menus for any other country
In this example, all U.S states are removed except California and Pennsylvania.
In this example, only 3 states from Australia can be selected.
Installation
Copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.
2 code snippets are included for the United Stated and Australia. For use with other countries, swapout the country and state codes in the PHP code.
You must be logged in to post a comment.