How to automate page translation if customer visit store from specific country

Dear Developers,
Need little assistance regarding the issue, automate translation of page during the visit of customer, whom belong to specific country?
I have tried to use Localization object but couldn’t get the solution, but it keeps giving the same answer which is English.
I’ve used VPN for this but answer is same. I am trying to figure out is this problem with my VPN or …
following is my code :

{% if localization.country.iso_code == 'FR' %}
French 
{% else %}
English
{% endif %}

Hi @ApoorvaSingh ,

The localization.country.iso_code you’re using only works if the customer manually selects the country or if you’re using Shopify Markets with automatic country redirection. Just using a VPN won’t change that value—it won’t auto-detect based on IP in Liquid.

So yeah, your code is technically fine.

But Shopify doesn’t auto-switch this based on location unless you’ve set up Shopify Markets properly.

If you want to show different content automatically based on the customer’s country (without them selecting it), you’ll have to use JavaScript with IP detection.

Try this:


Loading...

This fetches the visitor’s country using their IP and updates the language accordingly.

To test it properly: don’t just use any random VPN. Try incognito mode, clear cookies, or use a VPN that actually changes your full IP and DNS. Otherwise Shopify may still treat you like you’re in the original country.