Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Include collection name in product page url DAWN 10.0

Include collection name in product page url DAWN 10.0

TristaD
Tourist
5 1 2

Hi all, 

 

In a previous version of Dawn theme, I had edited the card-product.liquid file to include the collection name in the url of the product. So for example: mysite.com/collectionname/productname instead of just mysite.com/products/productname. This was working great for displaying my popup forms on only some products from collections, etc. 

 

The code I had changed in card-product.liquid was line 108: 

{{ card_product.url }}

 

To:

 

{{ card_product.url | within: collection }}

 

This worked beautifully to add in the collection name to the url of the product. 

 

However, I've just upgraded to Dawn 10.0, made this same change to the file, but it doesn't work the same. 

 

Any tips? Would the code need to be different? 

 

Thanks in advance!

Reply 1 (1)

oninnn
Shopify Partner
1 0 0

oninnn_0-1717468707959.png

you need to add object in card render in collection file. 

Then you can use that collection object. for example here. 

oninnn_1-1717468778751.png



Hope this helps.