Redirects of Product Pages

New Member
1 0 0

Hi there!

I have detected an issue with my website There are redirects on some product pages to pages with the same products, but with another one URL with "?variant= and a set of numbers" added. No variations are added to such products.

For example,

Product page: 

When trying to go to this page, it is redirected to the next page:

Such problem appears with many products. Why does it happen? How do I fix this problem?

Community Moderator
Community Moderator
252 43 48

Hi, @mcvazin

What you are experiencing with some of your links is referred to as variant deep links. This is intended behavior which allows you to link directly to a variant. There is great reply by another Shopify staff member outlining deep linking, and how you can potentially change them in this Community forum postI recommend reading through that post. It mentions that you can find more information about deep linking, and how it works here in our Partners Blog. 

Do the products with with these variant URLs have more than one variant added? If you are only selling one variant of these products, and would prefer to be able to use the shorter URL for the product, I recommend deleting variants that you will not be selling. This way, the product will not have any variants, and will be linked to the shorter URL you see on your other product pages. 

If the primary reason you are concerned about these URLs is for SEO (search engine optimization), I'll pass on a blog article we have on how search engines, such as Google, save and list web pages. It walks through various tactics you can follow in the form of a checklist to rank better on search engines. The link is here if you'd like to learn more!

Hilary | Community Moderator @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Shopify Partner
305 25 96

So checking the json data for that product - there is only one variant, the "Default Title" variant, variant id: 31768367759402 (that's where the ID is coming from anyway).

All singular (no-variant) products technically have this invisible variant called Default Title, just how sShopify works. 

Looking at how the page is loading, there is only one HTTP200 pageload, technically there is no "redirect" because there is no 2nd page load, nor is there a JS window.location change or meta redirect occuring. So my hunch was to look for a history state change, something like this:

history.replaceState(stateObj, '', 'bar2.html');

If you load the page, then devtools, sources, CTRL+SHIFT+F and search for 'replaceState', there are a few JS files, a prime candidate was the option_selection.js file - so I blocked the JS file URL in devtools reloaded the root page, and the URL change stopped (but it looks like the image loading broke). 

I would start by looking at changing the behavior of that file in your theme, likely there is an option_selector.js file somewhere.  



Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.