We will see in this tutorial how you can display the stock on your shopify product page

It is important for your customer to know if you have any units left in stock for your products and it also makes your product page more attractive.

Remember that in this tutorial we will display the real stock that combines all variants. This means that it is not recommended for dropshipping stores because the notion of out of stock is not the same.

You can see the end result on this demo store : https://speed-ecom-tutorials.myshopify.com/products/product-1

Password : speedfly

Let’s get technical ! 🙂

How to install the code

Go to the code editor of your shopify theme and open the “sections” folder.

Find the product-template.liquid file and use the search bar with Ctrl + F (or cmd + R) to find the line that contains “price”. Here is an example for the Debut theme.

If you can’t find this area try putting a random word at different places and refresh your product page to find the right spot.

You will now copy/paste the following code to that spot

.sd-items-count p { color:#ff2200; font-size:15px; padding:7px 0; margin:0; }
.sd-items-count img { float:left; width:20px !important;height:auto !important;margin:0 7px 0 0; padding:0; }
{% assign product_qty = 0 %}
{% for variant in product.variants %}
{% if variant.inventory_quantity > 0 %}
{% assign product_qty = product_qty | plus: variant.inventory_quantity %}
{% endif %}
{% endfor %}
{% if product_qty > 0 %}
<div class="sd-items-count">          
There are <span class="sd-count"><strong>{{ product_qty }}</strong></span> units left in stock.</p>
{% endif %}

If you want to put it on the featured product of your homepage, you will just have to find the file featured-product.liquid file in the sections folder.

Depending on the theme the name of the file may not necessarily be the same but if it is well coded then it will be 😉.

This tutorial is also available in video format

Hope you found this tutorial helpful !

You have any ideas for new tutorials ? Any questions about this one ? Leave me a comment 😉

182 Responses

  1. This was EXCELENT and did almost exactly what I was looking for!

    One thing, is it possible to do the same thing for variants? So it shows inventory on a specific variant enventory…

    Shoe Size
    9 (5 in stock)
    10 (2 in stock)
    11(Out Of Stock)
    12 (Out Of Stock)
    13 (1 in stock)

    instead of how it is now that shows 8 In Stock regardless of what variant you click on.

    Here’s one of my products as example…

    1. Thank you for your comment 🙂

      Hmm, unfortunately, from what it know it is not possible on Shopify because of technical limitations, not out of lack of wanting. Shopify groups the stock of all variants together.

  2. I want to hide product variants if variant quantity is less than three. or show out of stock if variant quantity is less than three.

  3. Thank you very much! It was very easy to follow your instructions and I was able to display the total quantities remaining for the total number of variants.

    Is it easy to modifiy the code to only show the quanities for specific items with a specific tag referenced?

  4. OMG! Thank you so much for this great tutorial! It did exactly what I needed quick simple and easy! I was very nervous about modifying adding to my code… This is all extremely new to me, but you made it easy to follow and understand! Thank you thank you thank you.

  5. Good day! I just want to offer you a big thumbs up for your excellent information you have got here on this post. Ill be coming back to your blog for more soon.

  6. [url=https://propecia1st.science/#]order generic propecia without prescription[/url] order cheap propecia no prescription

  7. can i get mobic prices [url=https://mobic.store/#]where can i get mobic without dr prescription[/url] order cheap mobic for sale

  8. how can i get mobic price [url=https://mobic.store/#]how can i get generic mobic without prescription[/url] buying mobic no prescription

  9. reputable mexican pharmacies online medication from mexico pharmacy or best online pharmacies in mexico
    http://girlequation.net/__media__/js/netsoltrademark.php?d=mexpharmacy.sbs п»їbest mexican online pharmacies
    [url=http://blackcreekcheddar.com/__media__/js/netsoltrademark.php?d=mexpharmacy.sbs]reputable mexican pharmacies online[/url] mexico drug stores pharmacies and [url=https://masterbationtube.com/user/zzeasvillj/videos]buying prescription drugs in mexico[/url] mexican mail order pharmacies

  10. mexican pharmaceuticals online mexico drug stores pharmacies or reputable mexican pharmacies online
    http://movie.newyouth.beida-online.com/__media__/js/netsoltrademark.php?d=mexpharmacy.sbs buying from online mexican pharmacy
    [url=http://xgluc.biz/__media__/js/netsoltrademark.php?d=mexpharmacy.sbs]mexico drug stores pharmacies[/url] mexico pharmacies prescription drugs and [url=https://www.support-groups.org/memberlist.php?mode=viewprofile&u=86462]buying from online mexican pharmacy[/url] mexican pharmaceuticals online

  11. buy medicines online in india buy medicines online in india or п»їlegitimate online pharmacies india
    http://bq–3cplxd5d.org/__media__/js/netsoltrademark.php?d=indiamedicine.world online shopping pharmacy india
    [url=http://bluesagesecrets.com/__media__/js/netsoltrademark.php?d=indiamedicine.world]india pharmacy[/url] indian pharmacy paypal and [url=https://www.support-groups.org/memberlist.php?mode=viewprofile&u=86714]indian pharmacy[/url] indian pharmacy online

  12. mexico drug stores pharmacies п»їbest mexican online pharmacies or mexico pharmacies prescription drugs
    http://jockeykidsstore.com/__media__/js/netsoltrademark.php?d=mexpharmacy.sbs mexican border pharmacies shipping to usa
    [url=http://www.dorienalongmire.com/__media__/js/netsoltrademark.php?d=mexpharmacy.sbs]buying prescription drugs in mexico[/url] mexican drugstore online and [url=http://www.lspandeng.com.cn/home.php?mod=space&uid=14997]pharmacies in mexico that ship to usa[/url] mexican drugstore online

  13. neurontin prescription coupon buying neurontin without a prescription or buy gabapentin online
    http://cnhfinancial.com/__media__/js/netsoltrademark.php?d=gabapentin.pro neurontin price comparison
    [url=http://bosanci.org/__media__/js/netsoltrademark.php?d=gabapentin.pro]neurontin prescription cost[/url] purchase neurontin online and [url=http://www.9kuan9.com/home.php?mod=space&uid=109157]buying neurontin without a prescription[/url] cost of brand name neurontin

  14. zithromax over the counter canada zithromax 500mg or zithromax 500 mg lowest price pharmacy online
    http://nhmunicipalassociation.org/__media__/js/netsoltrademark.php?d=azithromycin.men can i buy zithromax over the counter
    [url=http://pilgrimrewards.com/__media__/js/netsoltrademark.php?d=azithromycin.men]zithromax 500 mg[/url] zithromax online australia and [url=http://bbs.cheaa.com/home.php?mod=space&uid=2930965]zithromax for sale online[/url] order zithromax over the counter

  15. zithromax 500 mg lowest price online [url=https://azithromycin.men/#]can you buy zithromax online[/url] where can i buy zithromax in canada

  16. where to get avodart no prescription where can i get generic avodart tablets or where to get generic avodart pills
    http://icravethewave.com/__media__/js/netsoltrademark.php?d=avodart.pro how can i get generic avodart online
    [url=http://celebraterecovery.co/__media__/js/netsoltrademark.php?d=avodart.pro]where to get avodart pills[/url] cost avodart prices and [url=https://quantrinet.com/forum/member.php?u=493263]where to buy generic avodart[/url] how can i get generic avodart without rx

  17. can you get cheap avodart get generic avodart no prescription or can i get generic avodart no prescription
    http://discoverchickasaw.com/__media__/js/netsoltrademark.php?d=avodart.pro where can i buy generic avodart pill
    [url=http://cocokeywaterresort.com/__media__/js/netsoltrademark.php?d=avodart.pro]how to get cheap avodart pill[/url] can i buy cheap avodart without a prescription and [url=http://www.gearcup.cn/home.php?mod=space&uid=115498]avodart price[/url] how can i get avodart without rx

  18. indian pharmacy online [url=https://indiapharmacy.cheap/#]online shopping pharmacy india[/url] top online pharmacy india

  19. buying prescription drugs in mexico mexico pharmacies prescription drugs or mexico drug stores pharmacies
    http://cosaralisdesign.com/__media__/js/netsoltrademark.php?d=mexicanpharmacy.guru buying prescription drugs in mexico online
    [url=http://toter.us/__media__/js/netsoltrademark.php?d=mexicanpharmacy.guru]pharmacies in mexico that ship to usa[/url] п»їbest mexican online pharmacies and [url=http://byauto.net/home.php?mod=space&uid=636485]reputable mexican pharmacies online[/url] mexican online pharmacies prescription drugs

  20. Nice post. I learn something new and challenging on websites I
    stumbleupon every day. It will always be interesting to read articles from other writers and use
    something from other sites.

  21. canada drugs online review [url=http://certifiedcanadapills.pro/#]canada drugs reviews[/url] my canadian pharmacy

  22. Usually I don’t learn article on blogs, however I wish to say that this write-up very pressured me to try and do it!

    Your writing taste has been surprised me. Thank you, very great article.

  23. you’re actually a excellent webmaster. The site loading speed is amazing.
    It seems that you are doing any distinctive trick. Also, The
    contents are masterpiece. you’ve done a wonderful job on this subject!

  24. neurontin 4 mg neurontin 600 mg tablet or prescription drug neurontin
    http://small-reels-big-fish.com/__media__/js/netsoltrademark.php?d=gabapentin.tech neurontin 1200 mg
    [url=http://yourwaybrands.net/__media__/js/netsoltrademark.php?d=gabapentin.tech]neurontin 800 mg[/url] neurontin price comparison and [url=http://www.empyrethegame.com/forum/memberlist.php?mode=viewprofile&u=262624]neurontin prescription medication[/url] neurontin 600 mg price

  25. I do not even know how I ended up here, however I assumed this post used to be great.
    I don’t know who you are but definitely you are going to a well-known blogger if you happen to aren’t already.

  26. Software program and work process modifications should be documented
    and validated, together with verification that
    documented work process restoration tasks and supporting disaster restoration infrastructure permit
    staff to get better inside the.

  27. Thanks for your post on this blog site. From my personal experience, occasionally softening right up a photograph may provide the photography with a bit of an inventive flare.

  28. It’s in fact very complicated in this active life to listen news on Television, so I
    just use the web for that purpose, and get the latest news.

  29. canadianpharmacymeds is canadian pharmacy legit or pharmacies in canada that ship to the us
    http://commercialsuretybonds.com/__media__/js/netsoltrademark.php?d=canadaph.pro canadian pharmacy online ship to usa
    [url=http://crainsapps.com/__media__/js/netsoltrademark.php?d=canadaph.pro]canadian pharmacy india[/url] best canadian online pharmacy reviews and [url=http://80tt1.com/home.php?mod=space&uid=82396]canadian pharmacy[/url] canadian pharmacy online reviews

  30. Hello there, You have done an excellent job.
    I’ll certainly digg it and personally suggest to my friends.
    I am sure they’ll be benefited from this site.

  31. 77 canadian pharmacy canadian drug or canadian pharmacy meds
    http://horizoninformationservices.com/__media__/js/netsoltrademark.php?d=canadaph.pro canadian pharmacy online reviews
    [url=http://innertainment.com/__media__/js/netsoltrademark.php?d=canadaph.pro]canadian pharmacy checker[/url] trustworthy canadian pharmacy and [url=http://www.mmecaw.com/home.php?mod=space&uid=422763]ed drugs online from canada[/url] certified canadian international pharmacy

  32. buying prescription drugs online without a prescription online canadian pharmacies or buy without perscription
    http://webinformer.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu no prescription drugs online
    [url=http://atriumwizard.net/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu]online meds without prescription[/url] buy perscription drugs and [url=http://bbs.cheaa.com/home.php?mod=space&uid=2960598]canada mail order prescription[/url] buy canadian pharmacy

  33. buying online prescription drugs canadian pharmacy world coupon or how to buy prescriptions from canada safely
    http://sheldonduncan.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu best canadian mail order pharmacy
    [url=http://591capital.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu]canadian international pharmacy[/url] canadian pharmecy and [url=http://www.118btc.com/home.php?mod=space&uid=656069]mail order pharmacy canada[/url] top rated online pharmacy

  34. Hello, i read your blog occasionally and i own a similar one and i was just wondering if you get a
    lot of spam comments? If so how do you reduce it, any plugin or anything you can advise?
    I get so much lately it’s driving me crazy so any help is very much appreciated.

  35. best canadian drugstore canada drug store or ordering prescription drugs from canada
    http://www.cn-eximus.biz/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu international online pharmacy
    [url=http://exec-recruitment.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu]top online pharmacies[/url] how to get a prescription in canada and [url=https://kwik.adriensosa.fr/forums/users/cbtauxivyq/]mexican pharmacies online[/url] online pharmacy no rx needed

  36. buy medication online without prescription top canada drugs discount code or us based online pharmacy
    http://threefirersllc.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu discount canadian pharmacy
    [url=http://sno-ho.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu]us pharmacy in india[/url] canadian rx prescription drugstore and [url=http://www.fxwenxue.com/home.php?mod=space&uid=650465]canadian pharmacies online[/url] meds online no prescription

  37. Today, I went to the beach front with my kids. I found a
    sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the
    shell to her ear and screamed. There was a hermit crab
    inside and it pinched her ear. She never wants
    to go back! LoL I know this is completely off topic but I had to tell someone!

  38. buy rx online buying prescription medicine online or canada pharm
    http://freshipes.net/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu on line pharmacy canada
    [url=http://cleanisnotasmell.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu]no prescription needed pharmacy[/url] india online pharmacy and [url=http://tc.k33888.cn/home.php?mod=space&uid=2244444]legitimate online pharmacy usa[/url] certified canadian international pharmacy

  39. This piece of writing will help the internet visitors for setting up new blog or even a blog from start to end.

  40. online canadian pharmacy no prescription how to buy prescriptions from canada safely or canadian drugstores
    http://dokodemodoor.biz/__media__/js/netsoltrademark.php?d=interpharm.pro candaian pharmacies
    [url=http://openjfx.org/__media__/js/netsoltrademark.php?d=interpharm.pro]online canadian pharmacys[/url] canadian phamacy and [url=http://bbs1.857moli.com/home.php?mod=space&uid=466549]how to stop calls from canadian online pharmacy[/url] how to order prescription drugs from canada

  41. no prescription drugs online no prescription online pharmacy or canada drug center promo code
    http://www.callvillagepizza.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu canada pharmacies online prescriptions
    [url=http://wwfpiemonte.com/__media__/js/netsoltrademark.php?d=internationalpharmacy.icu]best online drugstores[/url] how to buy prescriptions from canada safely and [url=https://forex-bitcoin.com/members/287076-hzmyeaboea]order medication without prescription[/url] online drugs without prescription

  42. Pharmacie en ligne livraison gratuite Pharmacie en ligne fiable or acheter medicament a l etranger sans ordonnance
    http://stopmyrepairbills.net/__media__/js/netsoltrademark.php?d=pharmacieenligne.icu acheter mГ©dicaments Г  l’Г©tranger
    [url=http://berkshirehathawaytriangle.com/__media__/js/netsoltrademark.php?d=pharmacieenligne.icu]Pharmacie en ligne livraison gratuite[/url] Pharmacie en ligne sans ordonnance and [url=http://bbs.94kk.net/home.php?mod=space&uid=8063350]Pharmacies en ligne certifiГ©es[/url] pharmacie ouverte 24/24

  43. farmacia online miglior prezzo п»їfarmacia online migliore or acquistare farmaci senza ricetta
    http://907weather.com/__media__/js/netsoltrademark.php?d=farmaciaonline.men acquisto farmaci con ricetta
    [url=http://workingtv.com/__media__/js/netsoltrademark.php?d=farmaciaonline.men]farmacie on line spedizione gratuita[/url] farmacia online migliore and [url=http://www.ziyuangroup.com/space-uid-83206.html]acquisto farmaci con ricetta[/url] farmacia online senza ricetta

Leave a Reply

Your email address will not be published. Required fields are marked *