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.

Hey Sebboj,

Try this,

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

{% endif %}

Thanks,

Ritu