Display variant inventory quantity on product page (Debut theme)

jamboyjr
New Member
2 0 1

Hi Folks! Newbie to Shopify using Debut, not a coder :)

 

I've managed to cut and paste the following code:

{% comment %} Inventory tracking on product page {% endcomment %}
        <div id="variant-inventory" class="">
          {% if current_variant.inventory_quantity > 0 %}
          <i>{{ current_variant.inventory_quantity }} in stock.</i>
          {% else %}
          <i>Please contact us if you require this product.</i>
          {% endif %}
        </div>

on line 80 of snippet product-price.liquid, per stage9secrets' solution here.

 

This works brilliantly for single variant products - it displays the "X in stock." next to the price. The problem is when there are multiple variants: the number of items in stock of the first variant is displayed, regardless of which variant is selected.

 

Can anyone help me? As mentioned above I can't code but I can cut and paste if told what and where. Or is this a job for somebody more talented then I?

 

PS: I think it would be very helpful if the "in stock" option could be toggled on/off for this theme (or all of them), similar to customize theme->product pages->product pages->show variant selector. I sell yarn and my customers need to know if there are enough balls of yarn available to make a jumper before they try to add to cart. I'm sure I'm not the only shop where customers buy multiples of items ;)

Hello,

@jamboyjr 

Please reply me on matt.charlies28@gmail.com

 

Thanks

Matt

Apps On Demand

Shopify Expert: https://experts.shopify.com/ultimate-apps
0 Likes
Guleria
Shopify Partner
1306 269 361

Hello,

This needs customization in theme, shoot me an email if interested.

Thanks

Want to modify or custom changes on store hire me.
Email: guleriathakur43@gmail.com, Skype: navrocks1
If helpful then please Like and Accept Solution.
0 Likes
Komal_agg89
New Member
23 0 0

Hey,

It is possible, some customizations need to be done on your store. Ping me on 'support@anglerfox.com', I will be happy to help you!

0 Likes
jamboyjr
New Member
2 0 1

@Apps_On_Demand @Guleria @Komal_agg89 

Thank you all for your reply. I will follow you up in due course.

Kind regards

0 Likes
CiaoBella
Tourist
9 0 4

I sent you an email. Thanks!

0 Likes
Ann_Stewart
New Member
3 0 0

Hi @jamboyjr,

Were you able find a solution? I'm facing the same problem with this theme.  I've had two people look at it but they weren't able to help me.

0 Likes
KasperAndersson
New Member
2 0 0

{%- assign current_variant = product.selected_or_first_available_variant -%}

{{ current_variant.inventory_quantity }}

0 Likes

Try this might help.

 

 

<script> var product_variant_map = {}; {% for variant in product.variants %} product_variant_map["{{variant.id}}"] = {{ variant | json }}; {% endfor %} </script>

 

Shopify Expert | Arslan
Want to modify or custom changes on store hire me.
Skype : arsal.33
Mail : arslan.mumtaz04@gmail.com
Web; shopifydepartment.com
0 Likes
BootsyDumpster
New Member
1 0 0

I am wondering if you ever found an answer to your question. I sell wool roving and sell by different weights. I would like my customers to see the quantity of each weight available. Thanks, J

0 Likes