• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Essential Premium WooCommerce Plugins - WP Desk

  • Premium Plugins
  • Support
  • Blog
  • My Account
  • 0
Tomasz Drzewiecki

How to show or hide a checkout field for a specific country

Updated: September 01, 2020 / Checkout, Guides

Setting a shipping zone for a country opens the way to show or hide a checkout field only for customers from that country. All the necessary functions are included in the PRO version of Flexible Checkout Fields plugin. This is mainly because it supports conditional logic on the Checkout based on shipping methods. In this article I will show all the steps needed to get this feature - and thus benefit from the country-targeted checkout fields.

 

Customize the WooCommerce Checkout

Flexible Checkout Fields is a plugin for easy 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.

There are three types of rules to choose from:

    • conditional logic based on a product or category
    • conditional logic based on checkbox/radio/select field added by the plugin
    • and conditional logic based on the shipping method

 

Flexible Checkout Fields conditional logic rules - show or hide a checkout field
Conditional logic types available in Flexible Checkout Fields

 

More about conditional logic based on shipping methods in the article
Hide checkout fields based on shipping method in WooCommerce
by Bartosz Gajewski

 

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 for showing or hiding the field because shipping methods are assigned to specific locations (like country).

 

Checkout page field for a specific country

Step One: Set up a separate shipping zone.

  1. Add new shipping zone.
    WooCommerce > Settings > Shipping zones > Add shipping zone
  2. Set up the shipping zone.
    1. Enter a name.
    2. Select the country.
    3. Add at least one shipping method.
  3. Configure shipping methods.
  4. 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.

 

WooCommerce options are often insufficient - use Flexible Shipping plugin to expand the functionality and shipping configuration.

 

WooCommerce new shipping zone
Add new shipping zone

 

WooCommerce shipping zone setup
Set up the shipping zone

 

WooCommerce shipping methods options
Configure shipping methods

 

WooCommerce shipping zone order
Organize shipping zones

 

Step Two: Configure conditional logic in Flexible Checkout Fields for a specific country.

  1. Select the tab where you want to set the field with conditional logic (e.g. "Billing").
  2. Add a new field or select an existing one.
  3. Select the "Advanced" tab and check the "Enable Shipping Methods Logic" checkbox.
  4. Leave "Show this field if" turned on and click "Add rule".
  5. Select the created shipping zone along with the assigned shipping method. Then follow this step for each shipping method assigned to that shipping zone.
  6. Save.

 

Flexible Checkout Fields billing tab - show or hide a checkout field
Select the tab (e.g. "Billing")

 

Flexible Checkout Fields advanced tab - show or hide a checkout field
Select the "Advanced" tab and check the checkbox

 

Flexible Checkout Fields shipping methods logic - show or hide a checkout field
Leave "Show this field if" turned on and click "Add rule"

 

Flexible Checkout Fields shipping methods logic rules - show or hide a checkout field
Select shipping zones and shipping methods

 

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.

 

Flexible Checkout Fields hidden field
Hidden field for another country

 

Flexible Checkout Fields visible field
Visible field for the targeted country

 

PRO TIP - WooCommerce Debug mode

WooCommerce "Debug mode" is a helpful tool which shows at the Checkout if the customer from the selected country actually belongs to the dedicated shipping zone. Remember to turn it off before launching the store.

WooCommerce > Settings > Shipping > Shipping options > Enable debug mode

 

Summary

In conclusion - there are many situations where it may be useful to customize the WooCommerce Checkout that way. Show or hide a 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.

Flexible Checkout Fields PRO WooCommerce £59

Edit, add new or hide unnecessary fields from the checkout form. It's all about conversions and better user experience.

Add to cart or View Details
WP Desk
50,000+ Active Installations
Last Updated: 2021-03-03
Works with WooCommerce 4.7.0 - 5.0.x
Tweet

2 minutes read2409 views

Tomasz Drzewiecki

Happiness Engineer but more Happiness than Engineer. Member of the Rangers team responsible for Flexible Checkout Fields and Flexible Product Fields.

Powered by WP Desk

WP Desk brings you great WooCommerce plugins. We strive to save your time and money by speeding up your processes. Use our plugins to build a better store. Awesome support included in the package.

Premium WooCommerce Plugins →
WP Desk › Guides › How to show or hide a checkout field for a specific country

Footer

WP Desk - WooCommerce Plugins

At WP Desk we create great WooCommerce plugins with awesome support. Save time and money with our e-commerce solutions. See how we can help you improve your e-store →

Secured by Comodo

WP Desk

  • About us
  • Giving Back
  • Blog
  • Contact us

Products

  • Premium Plugins
  • FAQ
  • Docs
  • Get Support

Legal

  • Terms & Conditions
  • Refund Policy
  • Support Policy
  • Privacy Policy

© 2021 WP Desk