Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello. I had a problem that a lot of people seemed to had, and, as I wasn't able to find the answer I fixed it myself and I am sharing the answer.
I had pagination enabled, plus I wanted to hide the unavailable products. It is done like so.
In the collection-template.liquid, change:
{% paginate collection.products by 20 %}
For
{% paginate collection.products | where: "available", true by 20 %}
Then, locate the loop:
{% for product in collection.products %}
{% assign featured = product %}
<div class="grid__item {{grid_item_width}}">
{% include 'product-grid-item' %}
</div>
...
And replace it for:
{% for product in collection.products %}
{% if product.available == true %}
{% assign featured = product %}
<div class="grid__item {{grid_item_width}}">
{% include 'product-grid-item' %}
</div>
{% endif %}...
Thank you for posting this, sir. Unfortunately it did not work for me.
This does not work for me
{% paginate blogs['recipe-database'].articles | where 'tags','Chocolate' by 50 %}
{% for article in blog.articles %}
<h2>{{article.title}}</h2>
{% endfor %}
{% endpaginate %}
What behavior did you observe from this? Did the pagination display the normal number of pages and hide the products that did not meet the criteria?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025