Fixing Hreflang in Shopify
Shopify writes hreflang tags for you once a store sells to more than one market or language, so most Shopify hreflang errors are not missing tags but extra or mismatched ones: a theme or translation app adding its own set, a language labelled in the tags but not really translated, a market launched with an address pattern that redirects, or separate country stores that do not know about each other. This guide explains what Shopify generates and where, how to read it in your page source, and how to fix the errors the Hreflang Checker reports on Shopify stores, including stores run as several separate shops.
What Shopify generates, and where
When you sell to several countries or publish more than one language, Shopify adds hreflang link tags
to the head of storefront pages automatically. They are injected through the {{ content_for_header }}
object in your theme's layout/theme.liquid, which is why you will not find them written
anywhere in the theme files. Each tag pairs a language, and usually a country, with the address where
that version of the page is served.
What appears depends on three admin areas:
- Settings, Markets. Each market groups one or more countries. How its storefront
is reached, a subfolder such as
/en-ie, a separate domain such asexample.ieor a subdomain, decides the addresses in the tags. - Settings, Languages. Only published languages appear. A language that exists but is unpublished, or not added to a market, produces no tags.
- Settings, Domains. The primary domain and any market domains decide which host each tag uses.
For a fictional homeware store, Linen and Loom, selling in the UK and Ireland in English and in France in French, with subfolders, the output on a product page looks broadly like this:
<link rel="alternate" hreflang="en-GB" href="https://example.com/products/oak-tray">
<link rel="alternate" hreflang="en-IE" href="https://example.com/en-ie/products/oak-tray">
<link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/products/plateau-chene">
<link rel="alternate" hreflang="x-default" href="https://example.com/products/oak-tray">
The exact set varies by configuration, so treat that as a shape to compare against, not a guaranteed format. The point is that every page should carry one complete set, and every address in it should load directly.
The errors the checker usually finds on Shopify
| What the report shows | Likely Shopify cause | Where to fix it |
|---|---|---|
| Two sets of hreflang tags, or conflicting values for one locale | A translation app or old theme snippet adding tags alongside Shopify's own | App settings, or remove the snippet from the theme |
| A locale whose page is still in the store's default language | Language published before products and pages were translated | Finish translations, or unpublish the language for that market |
| Targets that redirect | A domain not set as primary for its market, or links hard-coded to an old address pattern | Settings, Domains and Markets; update hard-coded links |
| Missing return tags between two stores | Separate expansion stores; Shopify only links markets within one store | Hand-written tags in each store's theme |
| Codes that do not match the audience | A market's language or country set up differently from how pages are written | Market and language settings |
| Targets that are not canonical | Theme overriding the canonical tag, or collection-scoped product addresses | Theme head code |
Duplicate tags from themes and apps
Duplicates are the Shopify problem to rule out first. They happen when something other than Shopify
writes hreflang into the head: a translation or currency app that predates Shopify's built-in support,
a snippet an agency added to theme.liquid years ago, or an SEO app with its own international
settings. The page then carries two clusters that may disagree about codes or addresses, and Google has
to guess which one you meant.
To find the source, open a product page, view the source and search for hreflang. Then
in the theme code editor, search the whole theme for the same word:
{%- comment -%} Example of an old hard-coded block to remove from layout/theme.liquid {%- endcomment -%}
<link rel="alternate" hreflang="en" href="{{ shop.url }}{{ request.path }}">
<link rel="alternate" hreflang="fr" href="https://fr.example.com{{ request.path }}">
Blocks like this assume the same path works on every locale, which fails as soon as handles are translated, and they sit alongside Shopify's own tags. Remove them, after duplicating the theme as a backup. If the extra tags come from an app, look in its settings for an option to stop adding hreflang or alternate links; if there is none, ask the developer, or consider whether Shopify's own translation features now cover what the app was installed for.
render tags that reference it.Languages that are published before they are translated
When a language is published, Shopify serves that language's addresses for the whole catalogue. Where
a product or page has no translation, the storefront falls back to the default language text. The hreflang
tag still says, for example, fr-FR, but the page is in English. That undermines the cluster:
Google can see from the content that the page is not in French, and French searchers who do land there
get English text.
Before publishing a language, or before assigning it to a new market, translate at least the products, collections and pages you want found in that language, including the handles if you want localised addresses, the titles and the meta descriptions. Shopify's Translate and Adapt app or a translation app can show which resources are still untranslated. If a large part of the catalogue will stay untranslated for months, it can be better to launch the market in a language you have fully covered and add the second language later.
Translated handles also matter for broken targets. If you change a translated handle after launch, Shopify can create a URL redirect for the old one, but any links, sitemaps or hand-written tags that used the old address now point at a redirect.
Domains, subfolders and redirects
Shopify lets each market use a subfolder on the primary domain, its own domain, or a subdomain. Any of them can work with hreflang. Errors arise when the setup is half-changed, for example a market moved from subfolder to its own domain while old links, feeds or app settings still use the subfolder, or a country domain that is connected to the store but not set as the domain for its market, so it redirects to the primary domain.
- In Settings, Domains, confirm every domain you use is connected and assigned to the market it serves.
- Open each address from the hreflang tags in a private window. It should load directly, without redirecting to another market or asking the visitor to choose a country first.
- If you use an app or setting that sends visitors to a different market based on location, prefer a suggestion banner over an automatic redirect, so crawlers and visitors can reach every version.
- After changing a market's address pattern, update internal links, marketing feeds and any hand-written tags, and let Shopify regenerate its own.
Separate country stores
Some businesses run a separate Shopify store per country, often called expansion stores, for example
example.co.uk and example.de. Shopify generates hreflang only for markets within
a single store, so separate stores do not reference each other. To join them you add tags yourself in
each store's theme, and each store must list all the others, including itself.
This only works cleanly where the product handles match across stores, or where you keep a mapping.
A simple version for matching handles, placed in the head of layout/theme.liquid in each
store:
{%- assign path = request.path -%}
<link rel="alternate" hreflang="en-GB" href="https://example.co.uk{{ path }}">
<link rel="alternate" hreflang="de-DE" href="https://example.de{{ path }}">
<link rel="alternate" hreflang="x-default" href="https://example.co.uk{{ path }}">
That snippet assumes every page exists at the same path on both stores, which is rarely true for every product, search and account page. Limit it to templates where the paths match, such as products that exist in both catalogues, and store translated handles in a metafield when they differ, so each tag can use the right address. For many stores, moving to one store with several markets removes this maintenance altogether; weigh that against the reasons you chose separate stores.
The fix, step by step
Step 1
Map your markets, languages and domains
In the Shopify admin, open Settings and write down each market, the countries in it, the languages published for it and how its storefront is reached: subfolder, domain or subdomain. Note the primary domain and any separate Shopify stores you run for other countries. This map is what the hreflang output should match, and it often reveals a forgotten market, a language added for testing or a domain connected but never assigned.
Step 2
Read the hreflang Shopify actually outputs
Run the Hreflang Checker on the home page and on a product page of each market, then open
the same pages with View Source and search for hreflang. Compare the tags with your map:
one tag per market and language you intended, addresses that match the right subfolder or domain, and
one x-default. Note any locale that appears twice, any address that redirects and any value that surprises
you.
Step 3
Remove duplicate tags from the theme and apps
If the source shows more than one set of tags, search the theme code for hreflang
and alternate and remove hard-coded blocks, after duplicating the theme as a backup. Check
the settings of translation, currency and SEO apps for options that add alternate links, and switch them
off where Shopify already generates the tags. After uninstalling an app, look for snippets it left behind
in the theme.
Step 4
Publish languages only where content is translated
Open the translation tool you use and check how much of the catalogue each published language really covers. A language tag on a page still written in the default language misleads Google and visitors. Translate the products, collections and pages that matter, including titles, meta descriptions and handles, or unpublish the language for that market until the translation is ready, then relaunch it with the content in place.
Step 5
Settle domains and market addresses
In Settings, Domains and Markets, confirm each domain or subfolder is assigned to the right market so every address in the tags loads directly. Open each target in a private window and check it does not redirect to another market or show a forced country chooser. Replace automatic location redirects with a suggestion banner, and update internal links and feeds that still use an old address pattern.
Step 6
Link separate country stores by hand
If you run separate Shopify stores per country, add hreflang tags to the head of each store's theme so every store lists every other store's equivalent page and itself. Restrict the tags to templates where equivalent pages really exist, and use a metafield or mapping where handles differ. Make sure these tags agree with anything Shopify generates inside each store, so each page carries one consistent cluster.
Step 7
Recheck after every market change
Rerun the Hreflang Checker on each market after the changes, and again whenever you add a market, publish a language, change a domain, install a translation or SEO app, or switch themes. Those are the moments Shopify's output changes or something else starts adding tags. Keep your map from Step 1 up to date so the next person can compare the output against what was intended.
Keeping Shopify hreflang clean
- Let Shopify generate the tags for markets within one store, and avoid any second source.
- Treat publishing a language as a launch, with translated content ready first.
- Check the theme for hreflang code whenever you change or update themes, because copied snippets travel with them.
- Review app settings after installing anything that touches translation, currency or SEO.
- Keep one written map of markets, languages and domains, and check the Hreflang Checker output against it after each change.
For how clusters, codes and fallbacks work in general, see the Hreflang Guide. For choosing where visitors outside your markets should land, see the x-default guide.
1. Does Shopify add hreflang tags automatically?
Yes, for markets and languages within a single store. Once you publish more than one language or sell to more than one market with its own subfolder, domain or subdomain, Shopify adds hreflang link tags to storefront pages through the content_for_header object in your theme. You will not see them in the theme files, only in the page source. Separate Shopify stores for different countries are not linked to each other automatically.
2. Why does my Shopify store have duplicate hreflang tags?
Usually because something other than Shopify is also adding them. Common sources are translation or currency apps that predate Shopify's built-in support, SEO apps with international settings, and snippets added to theme.liquid by a previous developer. View the page source, search for hreflang and count the sets. Then search the theme code and check app settings, remove the extra source and let Shopify's own tags stand on their own. Recheck after every app install or theme change.
3. Can I edit the hreflang tags Shopify generates?
Not directly, because they are injected by Shopify rather than written in the theme. You change them by changing the settings they come from: markets, the countries in each market, published languages and domains. If you need tags Shopify cannot produce, such as links to a separate store, add your own in the theme, but make sure they describe the same cluster as Shopify's tags so the page does not carry conflicting information.
4. Should I use subfolders or separate domains for Shopify markets?
Either can work with hreflang, and Shopify generates tags for both. Subfolders keep everything on one domain and are simpler to manage. Separate country domains can suit brands with a strong local presence, but each domain must be connected, assigned to its market and able to load directly without redirecting. Whichever you choose, avoid changing the pattern after launch without updating links and feeds, because that turns targets into redirects.
5. What if my French market shows English text?
That usually means French is published but many products or pages have not been translated, so Shopify falls back to the default language. The hreflang tags still label those pages as French, which is misleading. Use your translation tool to see what is missing, translate the important products, collections and pages, including titles, descriptions and handles, or unpublish French for that market until the translations are complete, then publish it again once the content is in place.
6. How do I link two separate Shopify stores with hreflang?
Add hreflang link tags to the head of each store's theme, listing the equivalent page on every store plus the current page itself, and an x-default. This is straightforward where product handles match across stores and harder where they differ, in which case a metafield holding the other store's address helps. Limit the tags to pages that truly exist in every store, and check both stores with the Hreflang Checker afterwards.
7. Do Shopify geolocation redirects affect hreflang?
They can if they send visitors to another market automatically. A crawler requesting the Irish page might be redirected to the British one, so it cannot confirm the Irish version exists. Prefer a banner or pop-up that suggests the visitor's local store and lets them choose, rather than a forced redirect. Then every market's address loads for everyone, and hreflang points searchers to the right one from the results page.
The Hreflang Checker follows each cluster of locale pages and validates return tags, language codes, x-default, sitemap consistency, target reachability and canonical alignment.
Open Hreflang Fixes โ