Remove variant id from url

Topic summary

A user sought to remove variant IDs from product URLs on collection pages. The URLs were displaying as mysite.com/products/blue-shirt?variant=123456789 instead of the desired mysite.com/products/blue-shirt.

Another participant noted that variant IDs appear in URLs when a specific variant is selected, suggesting this behavior may be intentional.

Resolution: The issue was solved by disabling “show swatches” in the theme settings under product cards, which prevented variant selection on collection pages and removed the variant parameter from URLs.

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

Hi

I am trying to remove the variant id from the product link url string on collection pages.

Currently it displays like this:

mysite/com/products/blue-shirt?variant=123456789

But i want:

mysite/com/products/blue-shirt

Looked all around and seen various answers such as global.js etc but I can’t locate this file. I am using the theme flow.

Thanks

Could you please share your store’s URL?
Also showing the variant in the URL means that you selected a variant for that product, and it’s important to be there if that’s the case.

Solved.

I set “show swatches” to false in theme settings > product cards.