Shopify ?variant= URL Parameters Creating Near-Duplicate Product Pages
Search intent: fix · Updated February 2026
When a customer selects a product variant in Shopify (e.g., a different size or colour), the URL updates to include a ?variant=12345678 query parameter. Each variant URL is a separate, crawlable, indexable page with near-identical content - the same product title, description, schema, and images, differing only in the selected variant. Shopify themes should output a canonical tag pointing to the base product URL (/products/[handle]) regardless of which variant is selected. Additionally, if your theme uses JavaScript to update the URL on variant selection (history.pushState), this can override the canonical signal. The fix is to ensure the canonical always points to the base URL, not the variant URL.
Quick Diagnostic Checklist
- Navigate to a product page, select a variant, check the URL for ?variant= parameter
- View Source: confirm canonical href does NOT include ?variant= parameter
- Search Google site:yourdomain.com ?variant= to check indexed variant URLs
- Audit Liquid canonical tag in theme - confirm it uses product.url not canonical_url on product templates
- Check sitemap.xml for presence of ?variant= URLs
Not sure if your store has this issue?
Run a free scan to detect crawlability & indexing problems instantly.
What This Issue Means
A product with 5 colour variants and 4 size variants generates 20 ?variant= URL combinations. If Google crawls and indexes all of them - which it will, unless you implement correct canonicals - you have 20 near-identical pages competing for the same search queries. This dilutes ranking signals, causes Google to select the "wrong" canonical (often a variant page rather than the base product page), and wastes crawl budget on permutations that provide no unique value to searchers.
What Causes It (Shopify-Specific)
Shopify URL updates on variant selection by default
Shopify's default behaviour updates the browser URL bar to include the ?variant= parameter when a customer clicks a variant selector. This is implemented via JavaScript's history.pushState() or by direct URL navigation, creating a shareable and crawlable variant-specific URL.
Theme canonical tag outputs the current URL including variant parameter
Many themes use {{ canonical_url }} to output the canonical tag. In Shopify, canonical_url is context-aware and may return the variant URL when a variant is the active context - meaning the canonical tag points to the duplicate rather than the canonical base URL.
Google ignores canonicals it disagrees with
If variant pages receive external links, have unique title tags, or are included in the sitemap, Google may choose to index the variant URL as the canonical instead of the base product URL. Google treats canonical hints as advisory, not mandatory.
Variant images linked from collection pages
Some themes link directly to variant URLs from collection page swatches (e.g., clicking a colour swatch on the collection grid takes you to /products/t-shirt?variant=123). These internal links signal to Google that variant URLs are distinct, important pages.
How to Detect It Manually
- 1Navigate to a product page, select a variant (different colour or size), and check the URL bar - if it shows ?variant=XXXXXXXXX, variant URLs are being generated
- 2View Source on the product page with a variant selected - search for <link rel="canonical"> and confirm whether the href includes the ?variant= parameter or points to the clean base URL
- 3In Google Search Console → Pages → filter by your product URL pattern and look for indexed URLs containing "?variant=" - these confirm Google is indexing variant pages
- 4Search Google: site:yourdomain.com ?variant= - any results show Google has indexed variant URLs
- 5Check your sitemap.xml for ?variant= URLs - if present, you are actively signalling to Google that these are important pages
How to Fix It (Step-by-Step)
Enforce a base product canonical in your theme
In your theme.liquid or product template, output the canonical using product.url rather than canonical_url to ensure it always points to the base product URL, never the variant URL.
{%- if template contains 'product' -%}
<link rel="canonical" href="{{ shop.url }}{{ product.url }}">
{%- else -%}
<link rel="canonical" href="{{ canonical_url }}">
{%- endif -%}Prevent variant parameter URLs from appearing in collection swatches
If your theme links directly to variant URLs from collection swatches, update those links to point to the base product URL only. Let the product page handle variant selection.
{%- comment -%}
BAD: links to variant URL
<a href="{{ product.url }}?variant={{ variant.id }}">
{%- endcomment -%}
{%- comment -%} GOOD: links to base product URL {%- endcomment -%}
<a href="{{ product.url | within: collection }}">Confirm your sitemap excludes ?variant= URLs
Shopify's auto-generated sitemap.xml at yourdomain.com/sitemap.xml lists product URLs. Verify no variant parameter URLs are included. If you use a custom sitemap app, check its settings to ensure variant URLs are excluded.
Consider disabling URL updates on variant selection
If variant-specific URLs provide no SEO value for your store (e.g., each variant is not searched for independently), you can prevent the URL from updating on variant selection by removing the history.pushState() call in your theme's variant selector JavaScript. This is an advanced theme edit - test thoroughly before deploying.
How SEOScan Detects This Issue
SEOScan crawls product pages and programmatically triggers variant selections by modifying the variant selector input values. It captures the resulting URL after each variant selection and compares it to the page's canonical tag. If the canonical tag includes the ?variant= parameter, or if the URL updates to a variant URL while the canonical does not update to match the base product URL, a duplicate content warning is flagged. The tool also checks Google Search Console data (where available) for indexed ?variant= URLs.
Example Scan Result
Description
Product /products/mens-running-shoe has 12 variants (4 sizes × 3 colours). When variants are selected, URL updates to /products/mens-running-shoe?variant=41234567890. Canonical tag outputs the variant URL, not the base product URL. Google Search Console shows 8 of 12 variant URLs indexed.
Impact
Ranking signals for "mens running shoe" split across 9 near-identical URLs (1 base + 8 indexed variants). Google selected a variant URL as the canonical for 3 variants, meaning the base product URL may not be the page Google ranks.
Recommended Fix
Replace {{ canonical_url }} with hardcoded product.url canonical in theme.liquid. Confirm canonical always outputs /products/mens-running-shoe regardless of selected variant.
Code
{%- if template contains 'product' -%}
<link rel="canonical" href="{{ shop.url }}{{ product.url }}">
{%- endif -%}Why It Matters for SEO
Canonical Confusion and Ranking Dilution
When multiple near-identical URLs exist for the same product, Google must choose which one to index and rank. It frequently makes the wrong choice - indexing a variant URL instead of the base product URL - which means the page it ranks has a less clean URL and may have weaker link equity.
Crawl Budget on Large Catalogues
A store with 500 products, each with an average of 8 variants, has 4,000 potential variant URLs. Google may spend significant crawl budget on these near-duplicate permutations instead of discovering new products or content.
Link Equity Fragmentation
Any external links (from blogs, press, influencers) to specific variant URLs pass their authority to the variant URL, not the canonical base URL. This fragment of link equity is essentially wasted.
Search Console Data Fragmentation
When Google indexes variant URLs, your Search Console performance data splits across multiple URLs for the same product. This makes it difficult to assess the true ranking performance of a product and to identify optimisation opportunities.
Real-World Validation Signals
- Analysis of Shopify stores in Google Search Console commonly shows 20-40% of indexed product URLs containing ?variant= parameters, representing a significant wasted indexation proportion.
- Shopify's own developer documentation confirms that canonical_url on product pages with active variants may return the variant URL - the recommended fix is to explicitly use product.url for product page canonicals.
- After fixing variant canonicals, stores consistently see Google re-consolidating to the base product URLs in Search Console within 4-8 weeks, with no loss of rankings.
- Google's John Mueller has confirmed that ?variant= URLs are treated as separate pages unless proper canonicals explicitly point to the base URL.
Frequently Asked Questions
Q: Do variant URLs with ?variant= get indexed by Google?
Yes, unless your canonical tag explicitly points to the base product URL. Google will discover variant URLs from internal navigation, crawl them, and index them as separate pages. The canonical tag is a hint, not a directive - if Google sees strong signals that a variant URL is distinct (unique title, external links), it may index it regardless.
Q: Should I disallow ?variant= in robots.txt?
No. Disallowing ?variant= in robots.txt prevents Google from crawling variant pages, which also prevents it from seeing the canonical tags on those pages. A strong canonical pointing to the base URL is more effective and less risky than robots.txt disallow for query parameters.
Q: What if each variant genuinely has different SEO value (different colour searches)?
If you sell products where specific variants are independently searched (e.g., "navy blue chelsea boots" vs. "tan chelsea boots"), you may benefit from dedicated variant landing pages with unique titles, descriptions, and URLs - not ?variant= parameters, but distinct /products/chelsea-boots-navy and /products/chelsea-boots-tan slugs. This is a separate strategy from the generic variant URL issue.
Q: Does Shopify's auto-generated canonical handle this correctly?
Not reliably. The {{ canonical_url }} Liquid object in Shopify is context-dependent and may return the variant URL when the page context includes a variant. Using product.url explicitly - which always returns the base product URL - is the reliable fix.
Check Your Store for This Issue
SEOScan automatically detects shopify ?variant= url parameters creating near-duplicate product pages and 4 related issues - with specific fixes for your store.
Run Free ScanRelated Issues
Shopify /collections/all Duplicate Content Problem
Crawlability & Indexing · High
Shopify Canonical Tag Pointing to the Wrong URL
Technical SEO · High
Shopify Filter Page Duplicate Content from Faceted Navigation
Crawlability & Indexing · High
Shopify Tag Filtering Crawl Trap & Duplicate Content
Crawlability & Indexing · High