How to test Price Based on Country
How WooCommerce gets the customer country?
“Price Based on Country” displays the pricing and currency for the customer country, so let’s familiar how WooCommerce gets the customer country when geolocation is active:
- If the user is logged in, WooCommerce gets the customer country from the user account.
- For known users, WooCommerce gets the customer country from the session cookie. A known user is a user who added an item to the cart.
- In any other case, WooCommerce uses the user IP to guess his country.
Checking if Price Based on Country is working fine
The best way to check the plugin is working properly is using the checkout page. To run a test on the checkout page, do the next:
- Add a product to cart.
- Go to the checkout page and uncheck “Ship to a different address?”
- Change the billing country, the price of the product should change according to your settings.
The test mode allows checking how your prices look for a specific country. To enable the test mode go to WooCommerce → Settings → Zone Pricing and select Enabled Test Mode checkbox, after doing so, you have to select the country you want to test in the Test Country drop-down.
Now you can visit your site in a new incognito (private) window. Why in an incognito window? because:
- WooCommerce saves your country location in the session cookie. If you browse in incognito mode, your WooCommerce session cookie will be empty.
- To prevent your browser cache.
- To make sure you are not logged-in. If you run the test logged-in, WooCommerce gets the country from your user instead of by the geolocation function.
Before performing a new test you must close all incognito windows.
Testing WooCommerce Geolocation
Using an online service
There are at least 2 online services that allow you to test your website from different locations. As a result, you get a screenshot from each location:
Using a VPN Service
A VPN service allows you visit your store from different locations. There are a lot of VPN services available from which you can choose, but, in most cases, you can use a free service like TunnelBear.
TunnelBear is user-friendly, easy to set up and works across a variety of devices, including Windows PCs, iPads, iPhones and Android devices. TunnelBear service still covers more than 20 countries and can be used with up to five devices per account.
To test with a VPN software, like TunnelBear, follow the next steps:
- Install TunnelBear or other VPN software 🙂
- Clear your browser history (cache and cookies)
- Close your browser.
- Open your browser and connect TunnelBear, select the country you want to test.
- Check your “IP country” at ip2location.com. If country don’t match, wait and try again later.
- Visit your site.
To test another country you have to repeat the step from 2.