[SOLVED] How to customize checkout page by country with Shopify

Issue

This Content is from Stack Overflow. Question asked by Apoorva Singh

enter image description hereI am trying to customize checkout page according to country for my store Can you please help.
I am trying to using following code:

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

but on checkout it keep showing English even I have tried to change the location through VPN.



Solution

This is because localization.country returns the country of the storefront, not the user location. Shopify does not give any tool or API that would enable you to detect user’s location. You need to use an external geolocation service for that, ideally with a custom app acting as middleware to protect private keys. You might also try looking for an app in Shopify Store but it’s unlikely that as of 09.2022 you will find anything that would help you to solve that particular problem.


This Question was asked in StackOverflow by Apoorva Singh and Answered by TwistedOwl It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?