What's your biggest current challenge? Have your say in Community Polls along the right column.

How do I loop through all products in a collection using Liquid?

Solved

How do I loop through all products in a collection using Liquid?

ferar
New Member
4 0 0

I want to display the homepage collection products on my pages. I have made a custom section for this page, but I don't know how to show all collection products. Can anyone please help me?

Accepted Solution (1)
Huptech-Web
Shopify Partner
1010 204 217

This is an accepted solution.

Hey @ferar Please try this code

{% for product in collections.offering-collection.products %}
  <p>{{ product.title }}</p>
{% endfor %}

 

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required

View solution in original post

Replies 6 (6)

Huptech-Web
Shopify Partner
1010 204 217

Hey @ferar Please try this code

 

{% for product in collections.['your-collection-handle'].products %}
  <p>{{ product.title }}</p>
{% endfor %}

 

 If you need further assistance, please let me know. If you found my help useful, consider liking this message and marking it as the Accepted Solution.
Best regards
K.K

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
ferar
New Member
4 0 0

@Huptech-WebI tried this code, but it doesn't reflect anything in the preview.

Huptech-Web
Shopify Partner
1010 204 217

@ferar Please send me your collection handle, and I will provide the code.

You can find the handle of the collection by going to the collection page in your Shopify admin and looking at the URL. For example, if the URL is https://kaushik-dev.myshopify.com/collections/bracelet, then the handle would be a bracelet.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
ferar
New Member
4 0 0

My collection handle offering-collection

Huptech-Web
Shopify Partner
1010 204 217

This is an accepted solution.

Hey @ferar Please try this code

{% for product in collections.offering-collection.products %}
  <p>{{ product.title }}</p>
{% endfor %}

 

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
ferar
New Member
4 0 0

Working Thanks