By showing customers what stock you have available for a product or variant of a product you can increase your conversion potential and order size by creating urgency and need. We can set this up for you to show an in-stock message when you have a lot, and the only X left a message when you have a few or only 1 left message when you have just the single.
Editing your theme code to add this feature
- In the Section directory, find the
product-template.liquid
file or which file responsible for product template, and add the following code where you want to show the QAUNTITY, in this example we’ve added this after the product title:
{% comment %} Inventory tracking on product page {% endcomment %} <div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}"> {% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %} We have {{ current_variant.inventory_quantity }} in stock. {% else %} This product is available. {% endif %} </div>
- Congrats, You’ve completed the coding parts. Now it’s available in the product page. It’ll show the number of products available in the inventory. If inventory is not tracked then it’ll show “This product is available”.