Debut Theme - show inventory quantity on product page (and have it update on new variant select)

lyndonr
Shopify Partner
47 1 5

Hi everyone, 

The first part of my question, I've already figured out (thanks to this thread).

Here's the code I've added to product-template.liquid

            <div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
              {% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
              <span style="color:green">{{ current_variant.inventory_quantity }} available</span>
              {% else %}
              <span style="color:red">{{ current_variant.inventory_quantity }} available</span>
              {% endif %}
            </div>

 

What I'm having trouble with is figuring out the second part of my question. I need help adding the JS necessary to have that quantity number update when a new variant is selected. I assume this will go in theme.js.

Here's a test product on my development store:
https://michigan-navhda.myshopify.com/products/test-product

I've read through this thread but the solution is more complex than I need. I also suspect that Debut's theme.js file has changed since that thread was posted back in 2019.  

As always, any help is greatly appreciated. 

0 Likes