Duplicate hreflang tags on Shopify: where the second set comes from
A Shopify page should carry one set of hreflang tags. When it carries two, they often disagree, and search engines have to guess which to believe. Here is how a second set gets there, how to tell the sources apart, and how to keep just one.
How you end up with two sets
Shopify adds hreflang tags by itself through a setting called Automatic hreflang tags (Online Store > Preferences, in the social sharing image and SEO section). Those tags are printed by Shopify as part of the code every theme loads, so nothing in your theme can change or remove them. The setting is the only switch.
Anything else that prints hreflang tags therefore adds a second set rather than replacing Shopify's. The usual sources are:
- A theme snippet. Some themes, or past customisations, include a loop in the head that writes a tag for each language.
- A translation app. Many have a setting that adds hreflang tags for the languages they manage.
- An SEO or hreflang app. These usually add their tags through an app embed, and expect Shopify's to be turned off.
Two sets aren't automatically wrong if they say exactly the same thing. In practice they rarely do: one source writes fr where the other writes fr-CA, or points at a different address for the same page, and now the page sends two different answers.
Check whether you have two sets
Run a page through the free hreflang checker. It lists every tag on the page and flags the same language code listed twice. You can also view the page's source (Ctrl+U on Windows, Option+Command+U on a Mac) and search for hreflang: if the matches come in two groups, or one code appears twice, you have two sources.
Check a product page as well as the home page. Some sources only print tags on certain page types.
Tell the sources apart
In the page source, look at what sits around each group of tags.
- Shopify's own tags appear among the code Shopify adds to every page, close to lines that mention
Shopify.shopandshopify-features. If you turn off Automatic hreflang tags and this group disappears, it was Shopify's. - App tags are often wrapped in a comment that names the app. Hreflang Manager, for example, marks its tags like this:
<!-- hreflang-manager:start --> <link rel="alternate" hreflang="en-US" href="https://yourstore.com/"> … <!-- hreflang-manager:end -->
- Theme tags appear wherever your theme writes its own head markup, usually next to the theme's title, description and social sharing tags.
If you can't tell, turn sources off one at a time and check again after each change. Shopify caches pages, so give each change a minute or two before you look.
Keep one source
Decide which source you trust, then remove the others.
- To keep Shopify's tags: turn off the hreflang setting in your translation or SEO app, and remove any theme snippet (below). If Shopify's tags then pass the checker, this is the simplest setup.
- To keep an app's tags: turn off Automatic hreflang tags in Online Store > Preferences. Shopify's confirmation message says search engines won't get hreflang tags unless your theme, an app or another integration adds them, which is what you want here.
- To remove a theme snippet: duplicate your theme first (Online Store > Themes, the … menu, Duplicate), so you can go back. Then open the theme code, look in
layout/theme.liquidand any snippet with a name likeseoormeta-tags, find the lines that writehreflang, and remove them. A theme update can bring them back, so check again after updating.
Turning sources off is safe to undo. Each step above is one switch or one edit, and you can reverse it the same way.
After the fix
Run the checker again on the home page and one product page in each language. You're looking for one tag per language and market version, the page listing itself, and the pages it lists linking back. Our guide on how to check the hreflang tags on your Shopify store covers what else to look for.
If you'd rather not maintain this by hand, Hreflang Manager prints one set built from your markets, languages and translated URLs, checks during setup that no other tags are left on your home page, and its audit flags a second source if one comes back. It has a free plan.
Sources
- Google Search Central: Tell Google about localized versions of your page.