Displaying current inventory if under a certain quantity remain?

Highlighted
New Member
15 0 0

Im using Brooklyn and trying to display Inventory on my product pages. I am ideally trying to have it display if the inventory is under 9. Ive seen another post from 2015 on here that referenced an inventory section by Shopify but there isnt any information on that page anymore. Any suggestions? 

0 Likes
Highlighted

You can use the property inventory_quantity of variant liquid object in your theme code.

Here's just a simple example of usage

{% if current_variant.inventory_quantity > 0 and current_variant.inventory_quantity < 9 %}
<div class="product-inventory-count">
    <span>Only {{ current_variant.inventory_quantity }} in stock!</span>
</div>
{% endif %}
• If the problem is solved remember to click ✅ to Accept Solution
• Press Like, if the answer was helpful
• Shopify/Shopify Plus custom development, optimization and consulting. You can hire me here.
0 Likes