Liquify are official Shopify Experts & Partners since 2014. If you follow a link to Shopify from our website and make a subsequent purchase this may result in a commission at no extra cost to you. Our opinions remain our own.

Case scenario: you have 2 Shopify stores serving different geographical areas – e.g. US & UK. They have exactly the same products and descriptions. They 2 stores are simply serving different countries with different currencies (since Shopify can only have one currency per store).

Doing this will cause a duplicate content issue with Google which stinks for SEO. And on top of that Google won’t know which site to serve for which country. That is – unless you create hreflang tags (which you can read all about here on Google if you don’t know what they are.

I’m guessing that since you’re reading this that you do know what they are. These simple tags basically tell Google – which Shopify site you want to serve to users in different countries.

How to add dynamic hreflang tags to a Shopify theme using Liquid.

Here I’m going to give an example which you can copy and modify for your own Shopify stores. It uses liquid (the templating language of Shopify) to generate the tags. Please note this code needs to go in the head section of your theme.

(BTW – if you can’t understand and modify the code – hire a Shopify developer).

View raw code here.

This basically tells Google that:

1) the default for non English speakers is

2) the UK is served with

3) The US is served with and

4) the English speakers default store is

{{ canonical_url }} outputs the canonical url.

We then replace the shop (shop.domain) with the correct domain for the country.

So this example is for 2 stores. All the handles on both stores are the same. Because we used a CSV from one store to populate the second store we knew they were. You may wish to add more or less hreflang tags to your Shopify store for SEO depending on how many stores you have. This works perfectly for 2 stores.

Just be sure to add them before the end of the head section and also be sure to use liquid so that they are dynamically generated. If you don’t then your hreflang tags will be ignored by Google.

The above code works perfectly in our case scenario and outputs the correct tags into the source code. It does assume that handles are the same for all content. If your product/page/post handles aren’t the same then you’ll need to think of another solution because this won’t work (I can’t think of anything that will).

Need help with your hreflang togs for your Shopify store? Contact our Shopify developers today.

Joe Dempsey

Joe Dempsey

Joe Dempsey is a Shopify Expert. With over 8 years of experience in eCommerce & Shopify he leads one of the most experienced Shopify Expert teams in the world. Founder of Liquify, he tends to work with large brands and Shopify Plus merchants who want to scale aggressively. He is a well known Shopify SEO expert & one of the most experienced Shopify developers in the world.