How to get all products of a particular collection in Shopify

For getting all products of a particular collection, please follow the below steps:how-to-get-all-products-of-a-particular-collection-in-shopify

<div class="product_list">

  {% for product in collections.(collection-name).products %}
  <div class="product_details">

1. If you want to get product title then use this <h2> tag.

    <h2 class="product_title">{{ product.title }}</h2>

2. You can use this img code for showing product image.

    <span><img src="{{ product.featured_image | img_url: '600x600' }}" alt="{{product.featured_image.alt}}" /></span>

3. Here is the code for main price and compare price. 

    <div class="product_price">
      <span class="price-item">{{ product.price | money }}</span>

      <del><span style="color:red">{{ product.compare_at_price | money_without_trailing_zeros }}</span></del>
    </div>

4. If you need to show Vendor, SKU and Type of product, You can use this code.

    <div class="product_data">
      <div class="product_vendor">
        <p>Vendor</p>
        {%- for product_vendor in shop.vendors -%}
        <p>{{ product_vendor | link_to_vendor }}</p>
        {%- endfor -%}            
      </div>

      <div class="product_sku">
        <p>SKU</p>
        {%- assign current_variant = product.selected_or_first_available_variant -%}
        <p>{{ current_variant.sku }}</p>
      </div>

      <div class="product_type">
        <p>Type</p>
        <p class="section__title-desc product-single__title-desc">{{ product.type }}</p>
      </div>
    </div>

5. Get the product description by using this code.

    <p class="product-description">{{ product.description }}</p>
  </div>
{% endfor %}

</div>

how-to-get-all-products-of-a-particular-collection-in-shopify