title: loop on collection with specific number of products selected shopify
body: <p>I am new in liquid (shopify)</p>
  
  <p>I try to loop in a collection by a specific number of products in a cycle, but my output is wrong.
  To understand, example:</p>
  
  <p>output: First products from 1-6, then goes for 7-12, . But it shows only the first 6 products of the collections.   anyone can help me a bit in the code below?  Below is my code:</p>
  
  <pre><code>    {% assign product_x_page = 6 %}
  {% assign product_number_in_collection = collection.all_products_count %}
  {% comment %}{{ product_number_in_collection }}{% endcomment %}
  {% assign number_of_pag_cycle = product_number_in_collection | divided_by: product_x_page %}
  {% comment %}{{ number_of_pag_cycle }}{% endcomment %}
  
  {% assign image_size = 'compact' %}
  {% assign all_collection = 'related' %}
  {% assign heading = 'You may also like' %}
  
  {% if collection and collection.products_count &gt; 1 %}
  &lt;h3 align="center"&gt;{{ heading }} of {{ collection.title }}&lt;/h3&gt;
  &lt;br&gt;
  
  &lt;div class="slickslide_container" role='toolbar'&gt;  
  
  {% assign ciclo = 0 %}
  
  {% for loops in (1..number_of_pag_cycle) %}  
  
    &lt;div&gt; 
  
      &lt;ul class="related-products"&gt;
  
      {% assign ciclo = ciclo | plus: 1 %}
      {{ciclo}}
  
  
  
      {% for product in collection.products %}
  
            &lt;li&gt;
              &lt;div class="image"&gt;
                &lt;a href="{{ product.url | within: collection }}" title="{{ product.title | escape }}"&gt;
                  {{ product.featured_image | product_img_url: image_size | img_tag }}
                &lt;/a&gt;
              &lt;/div&gt;
              &lt;h4&gt;&lt;a href="{{ product.url }}" title="{{ product.title | escape }}"&gt;{{ product.title }}&lt;/a&gt;&lt;/h4&gt;
              &lt;span class="money"&gt;{{ product.price | money }}&lt;/span&gt;
            &lt;/li&gt;
  
      {% endfor %}
      &lt;/ul&gt;   
    &lt;/div&gt; 
  
  {% endfor %}  
  
  
    {% endif %}
  &lt;/div&gt;
  </code></pre>