Accessing images of products in a collection

Highlighted
New Member
1 0 0

I want to access only the images of products in a specific 'best sellers' collection. I used the following code:

{% assign collection = collections['Best-Sellers'] %}

<ul>
{% for product in collection.products %}
<a href="{{product.url}}">
<li>
<img src="{{product.image}}">
</li>
</a>
{% endfor %}
</ul>

 

I'm not entirely sure if I've written something wrong? Or how come this code isn't working. For example if I substituted the img with simply {{product.title}} I was able to access everything just fine. Can someone help me with this?

 

0 Likes