Loop through assets field on detail/product page I am trying to loop through an assets field called gallery on entries in a commerce products channel.

This field can have multiple images in it. I can get this to work on a channel listing page domain.com/shop/ but can't get this to work on the entry detail page domain.com/shop/products/detail/.

Any help is appreciated.

{% for asset in product.gallery.first() %}
    &lt;img src="{{ asset.url }}"&gt;
{% endfor %}
product.gallery returns an ElementCriteriaModel, which you can think of as a list of elements. product.gallery.first() will return the first element in this list.

What you want is to loop over all the elements:

{% for asset in product.gallery %}
  &lt;img src="{{ asset.url }}"&gt;
{% endfor %}


(Note that this will work if there are no elements in the list (because the for loop will never be entered). One thing you should avoid doing is product.gallery.first().url, because it is never possible to be certain without checking that there is a first element in the list.)