Please bear with me, I’m new to Shopify. I have been researching this topic, and am now familiar with editing my theme.js and product-template.liquid…but I just can’t get this working.
I want to be able to show the remaining inventory quantity on a variable product. Here is an example product from my page:
https://midwestmealworms.com/collections/mealworms/products/darkling-beetles
I’ve tried the suggestions from these threads:
I have been able to get the remaining inventory quantity for the variable product when the page loads, but when I select other quantities the available doesn’t update. However, if I refresh, it will show correctly. How do I get it to show dynamically without having to refresh the page?
Thank you in advance, if there is any additional information I can/should provide, please let me know.
Below is what I have in my product-template.liquid. I do not have any changes in theme.js, nothing I do there seems to help.
{{ 'products.product.regular_price' | t }}
{{ product.price | money }}
{% if product.compare_at_price > product.price %}
{{ 'products.product.sale_price' | t }}
<s>
{{ product.compare_at_price_max | money }}
</s>
{% else %}
{{ 'products.product.sale_price' | t }}
<s>
{{ product.compare_at_price_max | money }}
</s>
{% endif %}
{% include 'product-unit-price', variant: variant, available: true %}
{{ variant.inventory_quantity }} left in stock.