Back to blog
Hreflang Validator8 min readSeptember 3, 2026

How to Implement Hreflang in Shopify: Markets, theme.liquid and Separate Stores

Shopify generates hreflang automatically with Markets, but not always correctly. How to configure it, fix what the platform leaves out, and write it by hand for country-specific stores.


Shopify is the platform where hreflang is easiest to implement and easiest to believe is correct when it is not. If you use Shopify Markets, the platform injects the tags for you. If you run separate stores per country, it injects nothing and you have to write them yourself. And there is a middle case, the most troublesome one, where Shopify generates incomplete tags and nobody notices.

Scenario 1: Shopify Markets (the common one)

Markets is Shopify’s native system for selling into several countries from a single store. When you define a market with its languages, Shopify creates prefixed URLs (/es, /fr, /de-at) and adds the matching hreflang tags in the head, self-reference included.

  1. 1.In the admin, go to Settings → Markets.
  2. 2.Create or edit a market and assign the countries it covers.
  3. 3.Inside the market, under Languages, add the published languages. A language left as a draft generates neither a URL nor an hreflang tag.
  4. 4.Under Domains and languages choose how each market is served: subfolder of the main domain, subdomain, or its own domain.
  5. 5.Publish the changes. Shopify starts injecting tags as soon as the language is published.

The most repeated mistake: leaving a language as a draft. It shows in the admin as if it existed, but Shopify does not publish its URL or include it in the hreflang group. The store looks multilingual and, to Google, is not.

What Markets does not cover

  • Pages excluded from a market: if a product is unavailable in a market, that URL does not exist and must not appear in the group. Shopify usually handles this well, but check it on products with limited availability.
  • App-generated content: blogs, landing pages or pages created by third-party apps can fall outside the Markets system and be served with no hreflang at all.
  • Automatic geolocation redirects: if yours is aggressive, Googlebot may only ever crawl one version. Use Shopify’s recommended country selector rather than a forced redirect.

Scenario 2: separate Shopify stores per country

If you run example.com, example.co.uk and example.com.mx as independent Shopify stores, Markets cannot help: each store has no idea the others exist. The tags have to be written into the theme, and written into all three.

Edit theme.liquid in each store and add the block inside the head. This example assumes paths match across stores, which is what keeps it maintainable:

liquid
{%- comment -%}
  theme.liquid — inside <head>
  Same block in all three stores: the group must be identical
  and each store has to include itself.
{%- endcomment -%}

{%- assign path = request.path -%}

<link rel="alternate" hreflang="en-US"
      href="https://example.com{{ path }}" />
<link rel="alternate" hreflang="en-GB"
      href="https://example.co.uk{{ path }}" />
<link rel="alternate" hreflang="es-MX"
      href="https://example.com.mx{{ path }}" />
<link rel="alternate" hreflang="x-default"
      href="https://example.com{{ path }}" />

This method assumes the same path exists in all three stores. If a product only exists in the US store, the other two will generate a tag pointing at a 404 and Google will discard the whole group. Gate the block to templates where the catalogue matches, or maintain a map of exceptions.

Scenario 3: Markets with a dedicated domain per market

This is the middle ground: one Shopify store, but each market served from its own domain. Shopify still manages the group because it is still one store, though it deserves closer verification than subfolders: dedicated domains add a layer of DNS and certificate configuration where it is easy for a market to end up served on a URL that is not the one declared in the hreflang.

How to check what your store is actually generating

Do not trust the admin: look at the HTML being served. Open a product page in each language, find the alternate tags in the source, and check them together. What you are confirming is that all versions declare the same group, that each one includes itself, and that the country codes match markets that are genuinely published.

Try the tool for free

Analyze your URLs with Hreflang Validator by iRankly. No sign-up, no credit card.

Use tool for free

If you are on another platform, or want the conceptual detail of what each attribute does:


Try the tool for free

Analyze your URLs with Hreflang Validator by iRankly. No sign-up, no credit card.

Use tool for free