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?
Goal: Make a single button link to different URLs based on the visitor’s country (e.g., US → linkA, UK → linkB).
Proposed approaches:
Implementation notes (Approach 2):
Limitations mentioned:
Status: Guidance and example code were provided; the original poster has not confirmed a solution. Code snippets are central to understanding the proposed methods.
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](http://www.linkA.com)">[www.linkA.com](http://www.linkA.com)</a>
{% elsif localization.country.iso_code == 'FR' %}
<a href="[www.linkB.com](http://www.linkB.com)">[www.linkB.com](http://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.