I'm new in Shopify theme development. I'm stuck in for
loop
query. for
loop
not working properly when try to query by tag
. Below is my code.
{% assign query_tag = block.settings.home_section_tag %}
{% if collections.new-releases.products.size > 0 %}
{% for product in collections.new-releases.products limit:4 %}
{% if product.tags contains query_tag %}
<div class="col-12 col-md-6 col-lg-3">
<h3>{{ product.title | escape }}</h3>
</div>
{% endif %}
{% endfor %}
{% endif %}
Above code show me only 1 product it supposed to be 4 products. Also limit:1
, limit:2
, limit:3
not working (No product showing), limit:4
show me 1 product, limit:5
show me 2 products, limit:6
show me 3 products, limit:7
show me 3 product, limit:8
show me 4 products (it's on going). if I remove product query by tag
limit:
working properly. I don't understand what is the issue with my code.
I need help for this issue and need an explanation why it's not working.