How To Customize Content Based On Country With Shopify

When running an e-commerce store, it’s important to consider the needs and preferences of customers from different countries. One way to do this is by customizing the store’s content based on the customer’s location. In this blog post, we’ll explore how you can use Shopify to customize your store’s content based on the customer’s country.

One of the best options is to use Shopify’s built-in functionality to customize your store’s content based on the customer’s country. You can use the “Shopify Liquid” template language to create conditionals that display different content based on the customer’s country. For example, you could use a conditional to display different currency symbols or shipping options based on the customer’s country.

Today I am going to show you a real-time example. Before getting started make sure you know how Shopify liquid works. Let’s jump on!

Customize Content based on Country with Shopify

We are going to use country ISO code, using that we can wrap our content that conditionally shows, hides, or changes content based on the customer’s context. We can change whatever we like, this could be the theme header, footer, button, and so on.

Change product content based on country

Let’s say in our store we have two languages and different domains for each, for the default ( Sweden ) language we want to be shown the add to cart button, and for Norway the same button will redirect to the retailer website.

Let’s find out the button element first. Right-click on your mouse and inspect the element, you need to find the template so that we can customize content based on country.

Navigate to your theme, then Edit Code, and find your required template in this case it’s product-form-template. Search your template ( product-form ), we need the .liquid file.

{% if localization.country.iso_code == 'NO' %}
  <p><a class="btn btn--medium btn--full btn--primary" href="#">
    Go To Retailer Website
  </a></p>
{% else %}
  {{ 'products.product.add_to_cart' | t }}
{% endif %}

Basically here we are saying if the localization.code is equal to no means norway do something, else do something. That’s it we are done, using this technique we can do whatever we like, there are various ways to do this but I find it easier and helpful. Hope you enjoyed it. If you find it helpful let me know in the comments.

Video Guide