How can I change the URL structure for products on my website?

Solved

How can I change the URL structure for products on my website?

uchiha123
Excursionist
28 0 6

I'm aiming to change the URL structure for my website. Currently my product appears like this when accessed through the collection page: domain/collection/collection name/product name/variant.

I want a uniform structure for this common product on all collection pages, like this: domain/product/product name/variant. How can I make this happen? Redirecting all pages seems impractical for SEO, so I'm looking for alternative options.

Additionally I have one product with multiple variants, and each variant has its own collection. I'd like it so that if a customer clicks on say, the iPhone 15 variant, the loaded product page automatically selects iPhone 15 from all the variants. How can I achieve this?

I've included two images to make things clearer. These screenshots are from another website that has the ideal system I'm looking to implement on my website (which is also built on Shopify).

Screenshot 2023-11-14 154520.pngScreenshot 2023-11-14 154547.pngScreenshot 2023-11-14 154535.png

Accepted Solution (1)

Abdosamer
Shopify Partner
894 163 181

This is an accepted solution.

Hi @uchiha123  , I don't have access to theme files, but you should search for the collection template of your theme and locate : {{ product.url | within: collection }}, you will just need to remove the the |within:collection filter that manipulates the product original url.

Buy me a Coffee
Email : abdelrahamansamer71@gmail.com
Chat on WhatsApp
My work

View solution in original post

Replies 11 (11)

Abdosamer
Shopify Partner
894 163 181

This is an accepted solution.

Hi @uchiha123  , I don't have access to theme files, but you should search for the collection template of your theme and locate : {{ product.url | within: collection }}, you will just need to remove the the |within:collection filter that manipulates the product original url.

Buy me a Coffee
Email : abdelrahamansamer71@gmail.com
Chat on WhatsApp
My work
uchiha123
Excursionist
28 0 6

https://techshieldny.com/ this is my website url. There are several  {{ product.url | within: collection }}. So I'm kind of confused which one to change.

 

Abdosamer
Shopify Partner
894 163 181

Do you want to change the url for all products on your store t?

Buy me a Coffee
Email : abdelrahamansamer71@gmail.com
Chat on WhatsApp
My work
uchiha123
Excursionist
28 0 6

Suppose I'm browsing the neon case collection and select a specific product within that collection, I want the URL format to be domain/products/product name rather than domain/collection/products/product name. I want it same for all collections. The same url will be used for a single product in all collections when clicked. I hope I made this clear. Still if you have confusion you can check this website: flauntcases.com and try shop by style>select any collection>product>check the url vs ours.

Abdosamer
Shopify Partner
894 163 181

You should remove the |within : collection and just leave the product.url.

Buy me a Coffee
Email : abdelrahamansamer71@gmail.com
Chat on WhatsApp
My work
uchiha123
Excursionist
28 0 6

Actually there are several codes. Which one do I have to remove? I found some under mm-product.liquid and some other under product-card-grid.liquid. 

Screenshot 2023-11-15 013551.pngScreenshot 2023-11-15 013604.pngScreenshot 2023-11-15 013643.pngScreenshot 2023-11-15 013702.png

Abdosamer
Shopify Partner
894 163 181

Remove all if you want no collection to appear in the products url.

Buy me a Coffee
Email : abdelrahamansamer71@gmail.com
Chat on WhatsApp
My work
uchiha123
Excursionist
28 0 6

Thank you so much! The first problem is solved. Do you have any idea about the second issue?

error401
Tourist
4 0 1

Hi , I would like to find it and also modify it in the refresh theme because since yesterday I cannot find it thank you for your help

puffvapesto
Shopify Partner
3 0 0

Did you find the solution ? 

francess
Visitor
2 0 0

How can i do this in my minimalin-v1-1-6 shopify theme collection file beacuse i didnot find the file can you help me on this