Only one product in collection showing - Shopify Theme Development

I’m very new to shopify theme development and I’m currently working through a course. I’m trying to display all products in the collection however, it only displays a single product as shown here.

The product list is shown here.

<section class="container">
   {% for product in collections[section.settings.featured_collection].products %}
       <div class="card">
        <h3>{{ product.title }}</h3>
        <p>{{ product.price }}</p>
       </div> 
   {% endfor %}
</section>

{% schema %}
{
  "name": "Featured Collection",
  "class": "featured-collection-section",
  "settings": [
                {
                    "type": "collection",
                    "id": "featured_collection",
                    "label": "Collection"
                },
                {
                   "type": "text",
                   "id": "title",
                   "default": "Featured Collection",
                   "label": "Title"
                }
   
            ],
           "presets": [
               {
                   "category": "Collection",
                   "name":"Featured Collection"
               }
           ]
}
{% endschema %}

Hi @gbopola

Sorry for facing this issue, it’s my pleasure to help us.
Welcome to the Shopify community! and Thanks for your Good question.

add a product to the collection then it will work

Thanks a lot :slightly_smiling_face:

1 Like