How to show inventory count for variants on product page in debut theme?

Hello, I have combed through the community but cannot find a solution for my problem. I have added the following code on line 131 in product.template.liquid :

{% if product.variants.first.inventory_management == "shopify" %} {% if product.variants.first.inventory_quantity > 0 %} Only {{ product.variants.first.inventory_quantity }} left in stock. {% else %} The product is out of stock {% endif %} {% else %} This product is available {% endif %}
{% endif %}

The issue is that it only shows the inventory for a single variant when there are multiple variants. I would like to show remaining stock for each variant when that variant is chosen. Please advise!!

Hi @rfc_Char ,

This part needs to write more javascript. If you know the location of the code where the function click variant. You can share it here so people can help you.

Thanks you

Hi,

Did you check this guide from Shopify:
https://help.shopify.com/en/manual/online-store/themes/themes-by-shopify/vintage-themes/customizing-vintage-themes/show-remaining-quantity

1 Like

Hello,

This works and I was able to change the code to show “Available:” instead of “Stock:”. Thank you so much.

Char

1 Like