Ella Theme Product Quantity in Home Page

Shopify Partner
10 0 2



I need to enter the quantity of the product

to create scarcity on the store homepage.


I've read other articles from others using other

themes to do this by putting small code,


how can I do it with Ella?

What do you recommend?




I entered this in product-cards.liquid but

I can't get the correct number of the quantity

to appear because for all it then remains on 0!



{% assign total=0 %}
{%for variant in product.variants %}
{% capture i %}{{ total | plus:variant.inventory_quantity }}{%endcapture%}
{% assign total = i %}
<b style="color:red;">Disponibilità: </b><b style="color:red;">{{ total }}</b>





Replies 3 (3)
Shopify Partner
12 0 3



{% assign total = 0 %}
{% for variant in product.variants %}
  {% assign total = total| plus: variant.inventory_quantity %}
{% endfor %}


I tried your code snippet on my own store, and I also got zero. There is a possibility that the variables are not keeping the values in some way. Hopefully, reassigning the values after each iteration works!

EDIT: I updated the solution, and tested it on my own store. It works for me. 

Shopify Partner
10 0 2



I tried the solution, but it still shows 0, probably

this could work in the product tab, but I need the

quantity indicator in the homepage and shop page.


Shopify Partner
12 0 3

True. You need access to the product object. If its the home page, you need to access the object through collection like collection.products. Then run a loop through the collection.products. If its the product page, all you have direct access to the product object.