Use WooCommerce geolocation plugins to create country-specific product tables
We’re pleased to announce that our WooCommerce Product Table plugin works with a WooCommerce geolocation plugin. You can use this to show different content in your product tables depending on the customer’s country.
GeoTargeting Lite – WordPress Geolocation shows or hides completely different product tables depending on the customer’s country. Each product table can show products from a different category or tag. Use this plugin to show different products to different countries, listed in an interactive product table layout. GeoTargetingWP has joined the official WooCommerce Product Table compatibility scheme.
How to use GeoTargeting Lite with WooCommerce Product Table
Next, I’ll tell you how to create different product tables which appear depending on the user’s country.
How the WooCommerce geolocation plugin works
The free WooCommerce geolocation plugin comes with 2 shortcodes:
[geot country="US"] USA only content [/geot]
[geot exclude_country="US"] Everyone except USA will see this [/geot]
You can use these to show or hide specific content anywhere on your website depending on the user’s country. The geolocation plugin looks at their IP address to decide which country they’re in.
You need to know the correct 2-letter alpha country code for the geolocation to work.
How to create country-specific WooCommerce product tables
Use the WooCommere geolocation shortcodes to create country-specific product tables. I’m assuming that you have already set up WooCommerce and added your products.
- Install WooCommerce Product Table and GeoTargeting Lite – WordPress Geolocation.
- Go to WooCommerce > Settings > Products > Product Table, activate your WooCommerce Product Table license key, and configure the plugin settings to choose your product table columns, filters etc.
- Next, you need to label your products based on the countries they should be visible to. You can use categories or tags for this. Or if you’re already using categories and tags for something else, then create a WooCommerce taxonomy and use this instead. If you want a single product to appear for multiple countries, then it’s ok to put them in more than one category/tag/taxonomy.
- Create a new page where you will be adding the country-specific product tables.
- Next, you need to use the geolocation shortcodes to create product tables that are only visible depending on the user’s country. Put the [product_table] shortcode inside the geolocation shortcodes. This will show or hide a product table to the correct country only, depending on which shortcode you’re using.
- Add as many WooCommerce geolocation shortcodes to the page, each showing or hiding product tables from one or more countries. Use the examples below as guidance on how to do this.
Tip: If you want a specific product table to be visible or hidden from more than one country, then you can add multiple country codes within a single shortcode, Just separate them with commas.
Geolocation example 1
The following combination of shortcodes will create a page containing 2 product tables: 1 showing products from a category called ‘france-germany’ to customers in France and Germany only, and 1 showing products from the ‘UK’ category to customers in the UK only:
[geot country="FR,DE"][product_table category="france-germany"] [/geot] [geot country="US"] [product_table category="us"] [/geot]
As you can see, I have added two product tables to the page. However, each customer will only ever see one product table depending on their location.
Geolocation example 2
This time, we’ll use the exclude option to create a product table that will not appear for customers in the US. This assumes that you have tagged these products ‘US’:
[geot exclude_country="US"] [product_table tag="us"] [/geot]
Geolocation example 3
In this final example, we’ll use the include and exclude options together. This will create a product table that is visible to all countries except for Australia. It assumes that I have created a category called ‘Australia’ for the Australia-only products. It’s a useful method if sell different products to a specific country in WooCommerce, e.g. for legal reasons.
[geot country="AU"] [product_table category="australia"] [/geot] [geot exclude_country="AU"] [product_table exclude_category="australia"] [/geot]
All customers will see 1 product table on the page. Customers in Australia will see the products from the Australia category, and everyone else will see all your other products.
How to show and hide the country-specific products elsewhere on your site
The above instructions will only show or hide the products in your WooCommerce product tables.
You will need to use the geolocation plugin’s other features to restrict the visibility of products elsewhere in your store, for example on the main shop pages, widgets and single product pages. To help with this, you can use the above shortcodes anywhere on your site and in template files.
If you want to restrict access to any of the default WooCommerce pages and direct people to your geolocation product table page, then the free Redirection plugin is perfect for this. Simply add a redirect from any unwanted pages such as the main Shop page, and users will be taken to your product tables page instead.
Do any other geolocation plugins work with WooCommerce Product Table?
Right now, this is the only WooCommerce geolocation plugins that we know works correctly in the product table view.
We also tested with Product Country Restrictions and found that it works with WooCommerce Product Table. However, that plugin is no longer actively updated or supported, so we wouldn’t recommend it.
There are some geolocation plugins that definitely don’t work with it, and we have included these on our list of incompatible plugins.
There are other geolocation plugins that we haven’t tested with. Please let us know if you discover any more that work with WooCommerce Product Table, and we’d be happy to include them on this page.