Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
How do I add the same Inventory Status thats on my products to the home page as well?
Hi @Mybagobsession , thank you for posting here!
You can follow my instructions below:
Go to the Theme Editor:
Locate the Homepage Section Code:
Add Inventory Status Code:
{% if product.variants.first.inventory_quantity > 0 %} <p class="inventory-status">In Stock: {{ product.variants.first.inventory_quantity }} items</p> {% else %} <p class="inventory-status">Out of Stock</p> {% endif %}
This checks the inventory of the first variant of each product and displays whether the item is in stock or out of stock.
Style the Inventory Status:
To make the inventory status visually appealing, add some CSS to your theme's assets/theme.css or assets/style.css file:
.inventory-status { font-size: 14px; color: green; } .inventory-status.out-of-stock { color: red; }
Optionally, add the class out-of-stock for styling when an item is out of stock.
Save and Preview:
Unfortunately, this is not what I was talking about. I'm talking about inventory status. Not in stock & out of stock status.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024