Dynamically link to all the products in a store

Hey everyone, wondering if this way of linking to all the products in a store will create any problems in the future.

Not sure how you guys create links to all products, but I found this on StackOverflow, was wondering if it’s good enough

<a href="{{ shop.url }}/collections/all">Catalog</a>

Much appreciated :heart::heart:

Generally you’re snippet is all good - however just for some extra security regarding URL and stuff you couldshould use {{ all_products_collection_url }} as that’s specifically what’s its made for.

It will just return /collections/all which in itself is enough - no need for the {{ shop.url }} when it’s internal linking :blush:

bro I checked the routes object like 10 times before I asked, can’t believe I actually missed this :sob::sob::sob::sob: Thanks man appreciate it :heart::heart:

1 Like

Haha no worries - happy to help :+1: