How to show stock quantity for all variants in shopify?
How to show “xxx left in stock” on shopify product page? Shopify – show ONLY XX AVAILABLE IN STOCK on product page Start by adding snippet in product-template.liquid <div id="stockstatus"> {% if product.variants.size < 2 %} {% assign current_variant= product.variants.first %} {% endif %} {% if current_variant.inventory_quantity < 1 %} <p class="zero">Sold Out!<span class="variant-inventory">{{ current_variant.inventory_quantity }}</span></p> {% elsif current_variant.inventory_quantity < 6 %} <p class="few">Hurry! Only <span class="variant-inventory">{{ current_variant.inventory_quantity }}</span> left in stock.</p> {% else %} <p class="plenty"><span class="variant-inventory">{{ current_variant.inventory_quantity }}</span> available in stock.</p> {% endif %} </div> <script> var inv_qty = {}; {% for var in product.variants %} inv_qty[{{- var.id -}}] = {{ var.inventory_quantity | default: 0 }}; {% endfor %} </script> Now in theme.js or theme.js.liquid and edit function updateSku / _.updateSku ...