All things Shopify and commerce
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
Solved! Go to the solution
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
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)).
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
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.
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
how to replace this code?
find the code which mentioned above in that perticular file remove it and add my code thats all
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
i havn't tried yet but you should do some R&D it might be pssible with my code
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024