CanonicalTag.com logoCanonicalTag.comThe canonical tag & URL canonicalization
EcommerceEcommerce Platforms

Canonical Tags in Shopify

Shopify writes a canonical tag on every product, collection, and page automatically — the real risk is what your theme and apps do around it.

Does Shopify add canonical tags automatically?

Yes. Shopify auto-generates canonical tags on products, collections, pages, and blog articles without any setup on your part. The mechanism is a Liquid object, canonical_url, that Shopify populates for every page and that themes reference in the document head — typically in theme.liquid, sometimes broken out into a separate meta-tags.liquid snippet that theme.liquid includes. The typical output looks like this:

<link rel="canonical" href="{{ canonical_url }}">

Because this is baked into the theme layer and populated server-side by Shopify, you don't need to configure anything for a standard product, collection, or page to get a correct, self-referencing canonical tag. The variable is doing the work; your job is mostly to make sure nothing else on the site is fighting with it.

This matters because it changes where you should look when a canonical tag looks wrong on a Shopify store. On WordPress or a hand-rolled site, a missing or incorrect canonical often means someone forgot to add one. On Shopify, the default is already present and generally correct, so a wrong canonical almost always traces back to something layered on top of the platform default — a theme customization, an installed app, or a template that builds its own link tag instead of using canonical_url.

The collection vs product URL behavior

Shopify's product URL structure creates a specific pattern that's worth understanding on its own. A product can be browsed at a collection-scoped URL like /collections/denim/products/slim-fit-jean, but canonical_url always strips the collection segment and resolves to the clean, collection-independent form: /products/slim-fit-jean. This happens regardless of which collection path a shopper (or a crawler) used to reach the page.

The same folding behavior applies to variant URLs. When a specific product variant is selected via a query parameter, such as ?variant=12345, the canonical tag still points back to the base product URL rather than to the variant-specific address. Both behaviors are handled server-side by Shopify and are generally correct out of the box — they exist precisely to prevent the same product from being treated as multiple separate URLs.

The practical issue this creates isn't in the canonical tag itself — it's in how the rest of the site links internally. Breadcrumbs, related-products modules, and category-to-product navigation frequently link directly to the collection-scoped URL (/collections/x/products/y) rather than the clean product URL. Every one of those internal links sends link equity and crawl attention to a non-canonical address, even though the canonical tag on that page correctly points elsewhere. The tag is a hint, not a fix for where your internal links actually point.

How to customize the canonical in theme.liquid

For stores that need more control than the default canonical_url object provides, customization happens in the theme code itself, under Online Store → Themes → Edit code, inside theme.liquid.

One common pattern is a metafield-driven override with a fallback to Shopify's default. This lets a merchandiser set a specific canonical URL for a product when needed, while every other product continues using Shopify's automatic value:

<link rel="canonical" href="{% if product.metafields.custom.canonical_url %}{{ product.metafields.custom.canonical_url }}{% else %}{{ canonical_url }}{% endif %}">

Another common need is stripping query-string parameters — tracking parameters, sort order, filters — that would otherwise get appended to a canonical value if it's built manually rather than pulled from the default object. A simple split filter handles this:

{{ canonical_url | split: '?' | first }}

This takes whatever URL is in canonical_url, splits it on the ? character, and keeps only the first segment — effectively dropping any query string. Beyond these two patterns, template-conditional logic can be layered in to handle specific page types differently, and several Shopify apps (MIT Canonical URLs, SearchPie, SEO Manager, among others) offer canonical management without touching theme code directly.

Whichever approach you take, make sure the edit is deliberate and documented. Custom canonical logic in theme.liquid is easy to forget about months later, and an undocumented override is one of the harder things to diagnose when a canonical stops matching what you'd expect from the default canonical_url behavior.

Limitations and app conflicts

Not everything about Shopify's canonical behavior is under your control. Some canonical resolution is server-controlled at the platform level — you can wrap or reference {{ canonical_url }} in your own markup, but you can't always change the underlying value it resolves to for certain page types. Know the boundary between what theme code can influence and what Shopify's platform logic decides on its own.

Theme updates are a second, very practical limitation. If you've hand-edited theme.liquid to add custom canonical logic and later apply a theme update (or switch themes), those edits can be overwritten and silently lost, reverting the site to default canonical behavior without any obvious warning.

Third-party SEO and filtering apps are a frequent source of problems. Apps that also manage meta tags can end up injecting a second canonical tag alongside the theme's default, or in some cases stripping the canonical tag that would otherwise be present. Because this happens outside your theme code, it's easy to miss — the fix is to periodically check View Source on live pages rather than assuming the theme output is the only thing being rendered.

Finally, pagination canonical behavior on Shopify is genuinely contested across sources — there isn't a single, verified, documented default for how paginated collection or blog pages canonicalize. Rather than relying on secondhand claims, verify the actual behavior directly by viewing source on your live paginated pages.

Common Shopify canonical mistakes

Three issues account for most of the canonical problems that show up on Shopify stores.

  • Linking internally to collection-scoped product URLs instead of the clean product URL. Navigation, breadcrumbs, and related-product blocks that point to /collections/x/products/y rather than /products/y undercut the canonical tag's intent by sending internal link equity to a non-canonical address, even though the page itself correctly self-canonicalizes.
  • Apps injecting duplicate canonical tags. An SEO or marketing app that adds its own <link rel="canonical"> without checking whether the theme already outputs one results in two canonical tags on the same page — a conflicting signal rather than a clear hint.
  • Leaving tracking and filter parameters unstripped. Query parameters like ?sort_by=, filter parameters, or marketing tracking parameters (like ?utm_source=) that get carried into custom canonical logic without being stripped out can produce a canonical URL that isn't actually clean — defeating the purpose of consolidating duplicate variations of the same page.

Frequently Asked Questions

Does Shopify automatically add canonical tags to product and collection pages?

Yes. Shopify auto-generates canonical tags on products, collections, pages, and blog articles through the canonical_url Liquid object, which themes reference in theme.liquid (or a meta-tags.liquid snippet). No manual setup is required for standard behavior.

If a product is reachable through multiple collection URLs, does each one need its own canonical?

No. Shopify's canonical_url object always strips the collection segment from a product URL, so a product browsed at /collections/denim/products/slim-fit-jean still canonicalizes to the clean /products/slim-fit-jean. The same folding happens for variant query parameters, which canonicalize back to the base product URL.

How do I strip tracking parameters from a Shopify canonical URL?

Use Liquid's split filter on the canonical_url object: {{ canonical_url | split: '?' | first }}. This returns everything before the question mark, dropping any query string such as tracking or sorting parameters.

Will my custom canonical code in theme.liquid survive a theme update?

Not reliably. Theme updates and theme switches can overwrite hand-edited sections of theme.liquid, including custom canonical logic, reverting the store to Shopify's default canonical behavior without warning. Re-check custom canonical code after any theme update.

Why do I see two canonical tags when I view source on my Shopify store?

This is usually caused by a third-party SEO or marketing app injecting its own canonical tag in addition to the one the theme already outputs via canonical_url. Check installed apps that touch meta tags, and confirm actual output with View Source rather than assuming only the theme is rendering tags.