How to show my products complete quantity?

Highlighted
New Member
4 0 0

I'm current using the Venture theme but am still trying new themes. Regardless of the theme I'm using I want to know how to show the quantity of each product we have as this will play a role on our sales. Currently the Venture theme only displays this information once the quantity is under 10. I tried messing around with the code and can't seem to get it to show permamnetly regardless of amount.

 

Any help is appreciated.

0 Likes
Highlighted
New Member
4 0 0

Anybody around at this time with some info?

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
469 58 123

Hey, Angel!

I'm Lizzy, from the support team at Shopify.

I found this forum thread, which includes a snippet of code in the first comment which should achieve what you're looking for. This is the code.

 {% comment %} Inventory tracking on product page {% endcomment %}
            <div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
              {% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
              We have {{ current_variant.inventory_quantity }} in stock.
              {% else %}
              This product is available.
              {% endif %}
            </div>

I tested it on Venture, and it does work, even for quantities over 10. You'll want to add it in on your product-template.liquid file. This file is listed under Sections. Where you position it in the code will determine where it appears on your product page. 

I tested it underneath the price, which meant I was pasting the code after the "{% endif %}" on line 112 

Before making any changes to the theme code I always like to suggest duplicating your theme. You can do this by going to Online Store>Actions>Duplicate. Just in case.

Did that work for you? Let me know if you have any questions.

Thank you,

Lizzy
 

Lizzy | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

3 Likes
Highlighted
New Member
4 0 0

Lizzy thank you so much hat was exactly what I needed. I do have one more question if you or another member can answer. Is there a way to also get this info on to the catalog page? This way buyers can see the quantities before having to go to the products detail page.

Thanks again for your help

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
469 58 123

You're welcome Angel!

I found another forum post which may hold the answer you're looking for here. It has another example of code which was written to display stock quantities on your collection pages.

The post was a little bit older, so I adjusted the code, tested it in Venture and it works! You'll want to paste the chunk below into your product-card.liquid file. The text "Number of available units:" can be adjusted to say whatever you'd like.

<div>{% assign product_quantity = 0 %}
{% for variant in product.variants %}
{% assign product_quantity = product_quantity | plus: variant.inventory_quantity %}
{% endfor %}
Number of available units : {{ product_quantity }}</div>

Again, where you place it will determine where it appears. I had it between my title and price, so it appeared between <div class="product-card__name">{{ product.title }}</div> and {% if product.available %} <div class="product-card__price"> . It was around line 37.

Let me know if this works for you too!

Lizzy | Shopify Guru

Lizzy | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

1 Like
Highlighted
New Member
4 0 0

Lizzy,

Once again you were able to help me out and I appreciate it. I hope someone higher up in Shopify sees this and gives you some sort of bonus or even an employee of the month reward. Excellent job on your behalf, thanks again.

Angel

0 Likes
Highlighted
New Member
3 0 0
Hi Lizzy,

Hope u can advise me on this:
I have a few products some I need to sell in multiples of 20s and some I need to see in multiples of 5s.. I fixed the 20s by adding some qty coding I found in the community, however it applies to all my products. So how to I put in extra coding for certain products to sell in multiple of 5s or individually.

Thank u
0 Likes
Highlighted
New Member
1 0 0

Hey there, 

 

Thanks so much for this fix, worked perfectly.

I'm wondering if you can help me further.

Are you able to adjust the code so that if the quantity is not tracked or is zero or below then it isn't shown?

 

Many thanks, 
Kerryn

0 Likes