New

50% off Shop Products & 50% off 1st Month of Retainer Packages. Terms apply*. Contact us to apply your discount.

How to add hreflang tags in your Shopify theme

Last updated:

We're running a competition. Giving away a free SEO backlinks bundle to a lucky email subscriber in October.

*Terms and conditions apply.

Home » Articles » Shopify » How to add hreflang tags in your Shopify theme

If your Shopify store caters to multilingual or multi-regional audiences, implementing hreflang tags is a must. Hreflang tags are bits of code that indicate the language and regional targeting of a webpage. They guide search engines to serve the right version of your site to the right audience.

For example, if you have both an English version and a Spanish version of your Shopify store, hreflang tags will help Google know which one to show users based on their language settings or location. Store owners can add the tags to Shopify theme and this article will show you how to do it.

How to add hreflang tags in Shopify theme

To implement hreflang tags, you need to add them to the <head> section of your Shopify theme. You can do this by editing the theme.liquid file.

Start by going to your Shopify admin panel and navigating to the Online Store > Themes section. From there, click on Actions and select Edit Code. Open the theme.liquid file, find the <head> section, and insert the appropriate hreflang tags for each language or region.

Once you’ve added the tags, save the changes to update your site.

Here’s few examples of how they might look for different versions of a product page:

For an English product page, the tag would look like this:

<link rel="alternate" hreflang="en" href="https://your-store.myshopify.com/products/example-product" />  

For a Spanish version of the same page, it would be:

<link rel="alternate" hreflang="es" href="https://es.your-store.myshopify.com/products/producto-de-ejemplo" />  

And for a Spanish version targeting users in Mexico, it would look like this:

<link rel="alternate" hreflang="es-MX" href="https://es.your-store.myshopify.com/products

How to check the hreflang tags work after set up

Our recommendation tool for Shopify owners is Google Search Console. In Google Search Console, enter the URL of the page you want to check. Then, click “Inspect” to see the page’s details, including meta tags and hreflang attributes.

Another way is to look at the source code of your page. In the HTML, find the <link> tags in the <head> section—this is where you’ll spot the hreflang attribute.

To learn more about hreflang tags, you can explore Shopify’s multilingual store guides or refer to Google’s documentation. Both provide accurate advice and troubleshooting tips to help you get the most out of your setup.

We'll assist you in building a website that works through our exclusive newsletter

Kahunam values everyone who visits us. We have been secretly working behind the scenes to create useful resources like checklists, security guides, helpful tools and plugins, and exclusive deals and freebies to help visitors. All of this becomes yours when you subscribe (because the best stuff should go to the people who stick around).

Book a Discovery Call