Shopify: Adding Inventory Out-of-Stock Messaging
We’re working on a project for a client with a customized Shopify eCommerce website. They operate a jewelry store in Bel Air, Maryland but do a lot of business online for some of the unique artists they carry. They were looking for a solution for situations when they have an item out-of-stock, but would like to continue selling it with a notification that it will take 4-6 weeks to ship. Shopify has unique HTML-like system called ‘Liquid’ that allows you to customize the output of your page templates.
We put some code to together to display a message for these out of stock items. Please use it for your store if you want to do the same thing!
<div>
{{ product.description }}
<!-- out of stock display messages -->
{% if product.variants.first.inventory_quantity <= 0 %}
<p style="color:#ff0000">This item is currently out of stock.
Order today, and your item will be shipped in 4-6 weeks.</p>
{% case product.variants.first.inventory_quantity %}
{% when '0' %}
{% else %}
{% endcase %}
{% endif %}
</div>
<!-- .description -->
Have a question about how we implemented this? Leave a comment!
