Setting a shipping zone for a country opens the way to show or hide a WooCommerce checkout field only for customers from that country. All the necessary functions are included in the PRO version of the Flexible Checkout Fields plugin. This is mainly because it supports conditional logic on the Checkout based on shipping methods. See how to hide checkout fields in WooCommerce based on the country dropdown value.
Have you ever wanted to hide or add some of the checkout fields in WooCommerce based on the shipping zone or country? For example, to avoid questions from clients from one country about a certain checkout field that you need for the specific zone/ country?
Today, I will show you how to customize the WooCommerce checkout based on the country field with the Flexible Checkout Fields plugin! Hide checkout fields in WooCommerce in a few minutes!
Table of contents
- Customize checkout fields in WooCommerce
- How to show and hide WooCommerce Checkout fields - steps
- Summary - WooCommerce checkout fields based on country
Customize checkout fields in WooCommerce
Flexible Checkout Fields is a plugin for easily customizing the Checkout page. Its field management is also very simple and comes with one click. The Pro version also has the option of using conditional logic. Thanks to this function it is possible to show or hide a checkout field only if a specific condition (or several of them combined) is met.
The WooCommerce checkout customizer plugin I will use:
See how to hide checkout fields in WooCommerce
There are three types of rules to choose from:
- conditional logic based on a product or category
- conditional logic based on the checkbox/radio/select field added by the plugin
- and conditional logic based on the shipping method
At first glance, there is no way to set conditional logic based on the selected option in the country field. But in practice, we get this functionality by using the shipping method, as a rule, to show or hide a WooCommerce checkout field because shipping methods are assigned to specific locations (like country).
Show/ hide WooCommerce Checkout fields - steps
Step 1: Set up a separate shipping zone
- Add a new shipping zone.
WooCommerce > Settings > Shipping zones > Add shipping zone
- Set up the shipping zone.
- Enter a name.
- Select the country.
- Add at least one shipping method.
- Configure shipping methods.
- Organize shipping zones. 📦
If the country, is in more than one shipping zone - please drag the newly created zone and drop it over the other zone. In this example, Poland also belongs to the "Europe" shipping zone. That is why the "Poland" zone should be placed above the "Europe" zone.
Step 2: Configure conditional logic in Flexible Checkout Fields for a specific country
- Select the tab where you want to set the field with conditional logic (e.g. "Billing").
- Add a new field or select an existing one.
- Select the "Conditional Logic" tab and check the "" checkbox.
- Leave "Show this field if" turned on and click "Add rule".
- Select the created shipping zone along with the assigned shipping method. Then follow this step for each shipping method assigned to that shipping zone.
Step 3 - Hide WooCommerce checkout fields based on country dropdown
As a result - the field modified this way will be now hidden🥷🏽. But it will become visible when the customer selects this particular country in the "Country/Region" field. Also, it is possible to apply the opposite criterion - just select the "Hide this field if" option to hide that field from the customer.
PRO TIP - WooCommerce Debug mode
WooCommerce "Debug mode" is a helpful tool that shows at the Checkout if the customer from the selected country belongs to the dedicated shipping zone. Remember to turn it off before launching the store.
WooCommerce > Settings > Shipping > Shipping options > Enable debug mode
Summary - WooCommerce checkout fields based on country
In conclusion - there are many situations where it may be useful to customize the WooCommerce Checkout that way. Show or hide country-targeted fields to:
- collect address data of better quality
- place messages and labels in the language of a specific customer
- decide whether the field for a given country will be required or not
- and a lot more!
It is possible to test our plugin in action - our demo is waiting.