Count available products in a collection Shopify

Highlighted
Trailblazer
193 25 47

{% assign availableItems = 0 %}
{% for product in collection.products %}
{% assign itemavail = product %}
  {% if itemavail.available %}
    {% assign availableItems = availableItems | plus: 1 %}
  {% endif %}
{% endfor %}

{{ availableItems }} //Output

For Design, Development and custom changes Hire Me.
If your problem solved then Like & Accept this Solution.
Email ID: silencewebsolutions@gmail.com
Highlighted
Tourist
6 2 0

Thank you for posting this sir. Unfortunately it did not work for me.

https://community.shopify.com/c/Shopify-Design/Filter-only-available-products-while-using-pagination...

0 Likes