How can I modify my URL structure on an ecommerce platform?

Solved

How can I modify my URL structure on an ecommerce platform?

XJoseph
Shopify Partner
23 0 0

Hi Support,

Please help me about URL Structure please give me any code any solution how can i do this, like sub-collection
i want it that way : www.abc.com/collections/socks/products/pink-socks

Thanks

 
Accepted Solution (1)

Shay
Shopify Staff (Retired)
3110 472 645

This is an accepted solution.

Hi @XJoseph 

 

When hosting your website on Shopify, you cannot change the URL structure of your webpages. I recognize why you may wish to make this change, but it isn't something we support at this time. I will be happy to share this feedback with our developers though for further consideration. 

Shay | Social Care @ 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

View solution in original post

Replies 9 (9)

tim
Shopify Partner
3879 382 1418

Most themes use this URL structure when you go to a product page from the collection page.

It's done by using https://shopify.dev/docs/api/liquid/filters#within 

 

Sometimes people want to always use /products/XXXX URLs for SEO reasons -- to have single URL pointing to a product page -- when product belongs to 10 collections there are at least 10+1 URLs pointing to the product page.

Your theme may have already been modified to do so.

 

If you go to product page directly from homepage or other page, or from search results the URL will be different.

In part -- because a product can belong to several collections and there is no notion of "main" product collection.

 

This can be changed with some theme coding and metafields, but anyways it's at most single collection (you can't do /collections/socks/cotton/pink-socks (unless headless)).

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

Shay
Shopify Staff (Retired)
3110 472 645

This is an accepted solution.

Hi @XJoseph 

 

When hosting your website on Shopify, you cannot change the URL structure of your webpages. I recognize why you may wish to make this change, but it isn't something we support at this time. I will be happy to share this feedback with our developers though for further consideration. 

Shay | Social Care @ 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

XJoseph
Shopify Partner
23 0 0

Hi @Shay 
Thanks for your updated i really appreciate 

PalMultimedia
Shopify Partner
1 0 1

I am in favour to have control with URL & URL structures. Specially when migrating stores from other platform, keeping same URLs help to eliminate any SEO -URL issues.

Sarveshtech
Shopify Partner
8 1 2

i got the sollution go to this file : product-card.liquid
then replace this code : <a class="card-title link-underline{% if settings.product_title_line_text != 'full' %} card-title-ellipsis{% endif %}{% if variant_selected != blank %} card-title-change{% endif %}" href="{{ product_card_product.url }}" data-product-title="{{ product_card_product.title | escape }}" data-product-url="{{ product_card_product.url }}">
to this code :     

{%- liquid
...
assign product_url = product_card_product.url | split: '?' | first
assign collection_url = product_card_product.collections.first.url | split: '?' | first
-%}
...

<a class="card-title link-underline{% if settings.product_title_line_text != 'full' %} card-title-ellipsis{% endif %}{% if variant_selected != blank %} card-title-change{% endif %}" href="{{ collection_url }}{{ product_url }}" data-product-title="{{ product_card_product.title | escape }}" data-product-url="{{ collection_url }}{{ product_url }}">


by using above code you can change the url structure in this way www.abc.com/collections/socks/products/pink-socks

bhoomi4336
Visitor
1 0 0

how to replace this code?

Sarveshtech
Shopify Partner
8 1 2

find the code which mentioned above in that perticular file remove it and add my code thats all

TOC-MR
Excursionist
36 1 6

Hi @Sarveshtech it’s really super if this solution is working. Before I implement it, I have question. Is this also working with subcollections. So for example your collection is JBL and within this collection you have a sub collection called speakers. So you want the url to be

From

theonlinecollective.nl/collections/jbl/products/jbl-speaker-go-500


To:

theonlinecollective.nl/collections/jbl/speakers/products/jbl-speaker-go-500


Thanks for your reply 

 

 

Sarveshtech
Shopify Partner
8 1 2

i havn't tried yet but you should do some R&D it might be pssible with my code