All things Shopify and commerce
Scenario: The same button is clicked, User A from US, User B from UK.
User A when clicked direct to www.linkA.com
User B when clicked direct to www.linkB.com
How can i achieve this?
@Silax wrote:Scenario: The same button is clicked, User A from US, User B from UK.
User A when clicked direct to www.linkA.com
User B when clicked direct to www.linkB.com
How can i achieve this?
{% assign user_timezone = request.http_headers.X-Shopify-Timezone %}
{% if user_timezone contains 'America' %}
{% assign currency_code = 'USD' %}
{% elsif user_timezone contains 'Europe' %}
{% assign currency_code = 'EUR' %}
{% else %}
{% assign currency_code = 'GBP' %}
{% endif %}
try this logic and modify the code accordingly, placed the link in places of usd and euro
Hi @Silax
Here's how you can display different content on your Shopify site based on the user's geographic location, without using any third-party apps:
{% if localization.country.iso_code == 'US' %}
<a href="www.linkA.com">www.linkA.com</a>
{% elsif localization.country.iso_code == 'FR' %}
<a href="www.linkB.com">www.linkB.com</a>
{% else %}
<p>Default content for other countries</p>
{% endif %}
This will display:
You can apply this conditional logic to any element in your Shopify theme:
This approach has some limitations compared to using a dedicated app:
But for simple needs of customizing content per country, using localization.country.iso_code with Liquid conditionals is a lightweight, free solution that doesn't require a third-party app on your Shopify store.
Was this helpful? Like or Accept solution - Buy me a coffee ☕️
- Contact me: Xipirons | WhatsApp
- Shopify Developer based in France, helping online merchants succeed
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025