Help with adding stock count to collection page - Craft theme

Help with adding stock count to collection page - Craft theme

Booth
Shopify Partner
36 3 10

I'm trying to get the Craft theme in shape to use on my shop.  I need the stock count to display for each product on the collection page.

I've identified the file to edit:  snippets/card-product.liquid

 

I've added 

{% if card_product.available %}
<p>{{ product.inventory_quantity }} in stock</p>
{% else %}
<p>in stock soon!</p>
{% endif %}

 

but the variable, product.inventory_quantity isn't there.  I've tried current_variant.inventory_quantity, card_product.inventory_quantity, and several other guesses.

 

Anyone have any ideas of what variable exists for this number?   Or  where to look?  

I really don't want to hire a developer for this theoretically simple change.

 

--booth
Red Beauty Textiles
Reply 1 (1)

AnneLuo
Shopify Partner
933 173 199

Hi, @Booth 

You should use the variable

 

product.selected_or_first_available_variant.inventory_quantity

 

Hopefully it will help you. If yes then Please don't forget hit Like and Mark it as solution!

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me   

Buy Me A Coffee