How can I prevent Google from crawling product variants?

Topic summary

A Shopify store owner is struggling with Google crawling individual product variant URLs (e.g., pants-red-xl, pants-red-l, pants-blue-m), which is negatively impacting their Google Ads budget. They’re seeking a global solution to prevent indexing of these variant combinations.

Proposed Solutions:

  • Using robots.txt with disallow rules for each product line
  • Adding conditional meta noindex tags via Liquid code to theme.liquid for specific handles
  • Blocking variants through robots.txt after implementing noindex tags

Key Issue:
The store owner finds manual implementation impractical given the large number of variant combinations. They need an automated, scalable approach rather than adding code for each individual variant URL.

Current Status:
Another user reports experiencing the same problem. One responder questions why variants aren’t using the standard ?variant=123456789 URL parameter format (which would be easier to block) and requests the complete URL path to provide a tailored solution.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

Hi,

we are using clothes in our shop system with sizes and colors. So we get a lot of product combinations but do not want all inside Google. So how to handle that? Using robots.txt.liquid and add each single product line with disallow? Thats a lot. Is there another way by disable collections or something?

1 Like

Hey Sebboj,

Try this,

{% if handle contains ‘page-handle-you-want-to-exclude’ %}

{% endif %}

Thanks,

Ritu

I am not sure if i have explained it correctly.

Each product combination like

pants-red-xl

pants-red-l
pants-red-m

pants-blue-xl

pants-blue-l

pants-blue-m

…creates a full product url. Each of this created combination url is crawled by Google and kills our Ads budget for this reason i need to exclude those link combinations and allow only one of those product links.

With your code suggestion - as far as i understand it - i need to create it for each link and add it to the theme.liquid .. right? But this will blow up the code. There must be a rule to exclude this from the sitemap or block it in the robots.txt … i can do this manually but searching for a global solution

1 Like

I have the exact same problem… any help here?

Why are your variants not accessible via ?variant=123456789?

If so, you can block it via robots.txt. (after noindexing)

Guide: https://logeix.com/shopify-seo/robots-txt

Can you post the complete url path here without the domain. I may be able to find a solution.