The Shopify platform's handling of product variants, through the ?variant=<id> query parameter, is one of the more elegant pieces of commerce architecture in the industry. One canonical product URL, every variant accessible via a query string, a single set of Liquid templates rendering the whole thing. From an admin and merchandising standpoint, it is genuinely well-designed.
From an SEO standpoint, it is also the single most common source of duplicate-URL crawl waste, inconsistent canonical signals, and ranking authority dilution we see on Shopify accounts. Most stores have at least some variant-URL leakage. Some have it badly. A handful, usually the ones that have been through multiple theme migrations or app installations, have it disastrously.
This is the definitive guide to handling variant URLs correctly on Shopify, including standard Shopify, Shopify Plus, Hydrogen storefronts, and the third-party app ecosystem.
What ?variant= actually does
When a customer clicks a variant selector on a product page (size: medium, color: blue), Shopify's default behavior is to update the URL to:
/products/your-product?variant=12345678901234
The page does not navigate. The URL is updated via client-side JavaScript (typically via history.pushState). The variant selection drives the displayed image, price, availability, and SKU. From the customer's perspective, this is fine. The URL is sharable and reproducible.
From the crawler's perspective, every variant URL is a distinct URL. Googlebot will follow internal links that point at ?variant= URLs and queue them for crawling. The canonical tag is what tells Googlebot that those URLs all consolidate back to the master product.
The canonical strategy that works
The correct canonical strategy on Shopify is:
- One canonical URL per product: the master product page without any
?variant=parameter. - Every variant URL emits
<link rel="canonical" href="/products/your-product">pointing at the master. - Internal links (collection pages, related products, search results) should link to the master product URL, not to specific variant URLs.
- The XML sitemap should list only master product URLs.
- The
ProductJSON-LD emits the master product as the primary entity, with variants nested asOfferobjects inside anoffersarray (orAggregateOfferfor the price range).
This is what every major Shopify theme: Dawn, the OS 2.0 family, the legacy Debut/Brooklyn/Narrative themes, implements by default. The mistakes happen when this default is broken by customization or app installation.
The five ways the default canonical gets broken
In account audits, these are the recurring patterns:
1. Theme customization that overrides canonical
A developer (or a previous agency) adds a custom canonical tag in theme.liquid that includes the request's full URL via {{ canonical_url }}- without checking whether the URL contains ?variant=. Shopify's canonical_url Liquid object handles this correctly by default, but custom code that builds the canonical from request.path or similar primitives often does not.
The fix: use Shopify's canonical_url object, which strips query parameters appropriately, instead of building canonicals from scratch.
2. Apps that inject variant-specific links into the head
A handful of apps, particularly some review apps, recommendation apps, and feed-generation apps, inject their own <link> tags into the document head. Sometimes those tags include rel="canonical" pointing at variant URLs. The result is multiple conflicting canonical tags on the same page, which Google resolves arbitrarily.
The fix: audit every active app and check the rendered head for duplicate canonical tags. Block the app from injecting canonicals if you cannot configure it correctly.
3. Internal links that target variants
The product card on a collection page links to /products/your-product?variant=12345 because a developer thought it would be helpful to land the customer on the specific variant. Now every internal link from the collection page is a variant URL, and Googlebot has to follow them all before discovering the canonical signal.
The fix: collection links should always point to the master product URL. Let the customer pick the variant on the product page.
4. XML sitemap leakage
Shopify's auto-generated sitemap is reliable, but custom-generated sitemaps (often built by SEO apps) sometimes include ?variant= URLs. Once those are submitted to Google Search Console, the variant URLs get explicit crawl priority.
The fix: confirm the sitemap contains only master product URLs. If a custom sitemap is in play, regenerate it. If a third-party app is generating the sitemap, replace it with Shopify's native one.
5. The variant-as-color-pattern
This one is intentional and worth understanding separately. Some Shopify merchants want each color variant to rank for its own color-specific queries ("red dress shirt", "blue dress shirt"). The standard variant model does not support this. All variants share one URL.
The workaround: create separate products for each color variant instead of using variants. Each color has its own product URL, its own canonical, its own description optimized for color-specific queries, and its own ranking trajectory. This is a merchandising decision, not a technical workaround. It adds inventory management complexity in exchange for more granular ranking surface.
There is a hybrid model: use Shopify Markets to generate separate URLs for high-value variants while keeping the variant structure intact. This is more nuanced and depends on the catalog's specific structure.
Hydrogen and the variant URL question
On a Hydrogen storefront, the variant URL strategy is the developer's choice. There is no platform default to fall back on. The correct pattern:
- The product route (
/products/[handle]) accepts an optional variant identifier (either as a query parameter or a path segment, your choice). - The route loader fetches the product from the Storefront API regardless of which variant is selected.
- The canonical tag emitted in the SSR response always points at the variant-stripped URL.
- The
ProductJSON-LD is generated server-side from the full variant list, not the selected variant.
Hydrogen merchants who deviate from this pattern (typically by emitting variant-specific canonicals, or by treating each variant as a separate route) almost always regret it within six months.
Shopify Markets and the locale variant question
Markets adds another dimension. A ?variant=12345 URL under /en-gb/products/your-product is a different URL than ?variant=12345 under /de/products/your-product. The canonical strategy still applies, each locale's master product is its own canonical, and hreflang annotations should reciprocally link the locale variants of each master product.
The mistake to avoid: setting the canonical on /de/products/your-product to point at /products/your-product. That is wrong. It consolidates the German page into the English one. Each locale's master is its own canonical; hreflang handles the cross-locale relationship.
How to audit your variant URL health
The 15-minute audit:
- Pick a high-traffic product. Visit the master URL. View source. Find the canonical tag. Confirm it points at the variant-stripped master.
- Append
?variant=<some id>to the URL and reload. View source. Confirm the canonical still points at the master (not at the variant URL). - Search Google for
site:yourdomain.com inurl:variant=. If results appear, variant URLs are in the index. The volume tells you how serious the problem is. - Open Google Search Console → Pages → All known pages. Filter for URLs containing
variant=. The count is the crawl footprint. - Check the rendered head for duplicate canonical tags. If there are two
<link rel="canonical">tags, an app is misbehaving.
Variant URL Canonicals on Shopify: The Definitive Guide FAQ
Should I redirect variant URLs to the master? No. The canonical tag is the right signal. 301-redirecting variant URLs breaks the customer-sharing use case: when someone shares a link to the blue medium variant, they want the recipient to land on that variant.
Will Google penalize my site for variant URLs? No. The canonical tag tells Google how to consolidate the signals. The only risk is wasted crawl budget on very large catalogs.
Should I add variant URLs to the sitemap? No. Master URLs only.
Does the variant matter for Merchant Center? Yes: each variant should be its own item in the Merchant Center feed, with the master URL as the link. The variant differentiation happens at the feed level, not the URL level.
Key takeaways
- The default Shopify canonical strategy is correct. Most variant-URL problems are caused by customization or apps that break the default.
- One canonical URL per product, every variant URL canonicalized to the master. Sitemap and internal links use master URLs only.
- If you genuinely want each color variant to rank, use separate products, not variants.
- Hydrogen requires explicit canonical handling. There is no default.
- Audit by viewing source on a variant URL and confirming the canonical points at the master.
For deeper Shopify SEO work, see our Shopify SEO, Shopify Plus SEO, and Hydrogen SEO practices. As a Shopify Plus Partner with deep experience across the platform, we have shipped variant-URL audits and fixes across hundreds of accounts. The Shopify support practice handles ongoing variant-URL hygiene. When you are ready to talk, we are here. For the platform-by-platform view, browse SEO by platform.

