Code to show stock levels next to sub categories from the product drop downs on navigation

13 0 0

I don't know if this will makes sense but I'm wondering if there is a way to add the total amount of items in stock for each sub category. For example on my home page u can drop down "Pokemon TCG" to set lists then you click say "Shining Fates" which will show 3 sub categories. I'd love for it to show on each of those 3 sub categories the total items for sale in there. I use the Dawn theme and web URL is


Hi @HypeByte,

See if this code helps.

{% for product in collection.products %}
  {% if  product.title == " of the product..."  %}
    {{ product.title }} {{ product.variants.first.inventory_quantity }}
  {% endif %}
{% endfor %}

If you need more specific help, share the code from the header where you have the class "header__menu-item" and the class "header__submenu"?

You may find the code in the file in sections > header.liquid.