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
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025