I am new in liquid (shopify)
I try to loop in a collection by a specific number of products in a cycle, but my output is wrong. To understand, example:
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:
{% 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 > 1 %}
<h3 align="center">{{ heading }} of {{ collection.title }}</h3>
<br>
<div class="slickslide_container" role='toolbar'>
{% assign ciclo = 0 %}
{% for loops in (1..number_of_pag_cycle) %}
<div>
<ul class="related-products">
{% assign ciclo = ciclo | plus: 1 %}
{{ciclo}}
{% for product in collection.products %}
<li>
<div class="image">
<a href="{{ product.url | within: collection }}" title="{{ product.title | escape }}">
{{ product.featured_image | product_img_url: image_size | img_tag }}
</a>
</div>
<h4><a href="{{ product.url }}" title="{{ product.title | escape }}">{{ product.title }}</a></h4>
<span class="money">{{ product.price | money }}</span>
</li>
{% endfor %}
</ul>
</div>
{% endfor %}
{% endif %}
</div>