Entering a custom message on inventory display when stock is at zero

Hi

For many of our products, if they go to zero stock, we can still get them, but it would be nice to let customers know there is a delay and we’re ordering them in, rather than them thinking an items is in stock.

I used to have a little but of custom code which did this, I think I added it to the product.liquid page. Any idea what I can use.

Ideally I want it to say ‘not in stock but we can order this in for you’ and I’d only want it to work on the products which had the ‘continue selling when out of stock’ button ticked? Or simply showing that it’s not in stock, but still orderable?

Can anyone help with this?

Hi @OrionLee ,

You have to just copy and paste this code in your product.liquid file or whatever product-template.liquid file

{% unless product.available %}
  

Not in stock but we can order this in for you

{% endunless %}

Your custom message will show when inventory is 0.

Please let me know if works and mark as solve!

Thanks I will give this a go, I think my them is in JSON though, rather than liquid. I assume that might make a difference? My previous theme was liquid.

@OrionLee There will be a liquid file in the section or snippet in sidebar of Shopify coding. there you can find and paste above code.

Does it have to go into product.liquid?

There’s no product.liquid in either snippets or sections for some reason

@OrionLee Paste the code in the product-variant-options.liquid file it will show text above the variant options.

Hmm

Not sure if I have put it in the right place

Example of item it should be showing on https://shop.girlguidingnwe.org.uk/products/leaders-trefoil-woven-badge

Do you have Product info template or main product template if you found then please find for this class code product__tax caption rte if you found this class then just put above under this class name.

Like this?

That’s great! You are too close. just paste the code above this line that’s it!

{%- if shop.taxes_included or shop.shipping_policy.body != blank -%}

Now I hope it will definitely work!

I don’t think it has worked :disappointed_face:

@OrionLee You didn’t place the code above the {%- if shop.taxes line just place above it. and check it will work.

Apologies!

Still not sure it’s worked though

@OrionLee Perfect, now you can create any test product and add inventory 0 and check it will show your custom text.

Hmm

I already have a number of items like this - for example https://shop.girlguidingnwe.org.uk/products/guides-trefoil-woven-badge

But it’s not showing,

I checked your example link but there is showing Add to Cart button that means this product have inventory. If product have zero inventory then button should show Sold Out instead of Add to Cart, that means you doing something wrong.

It has potential inventory - I can order it from our supplier. I don’t want to prevent people from being able to buy the item. I just want them to know we don’t have it physically in stock at the time it’s purchased.

Hey, @OrionLee

You have the option to input a personalized message that will appear when your product’s stock reaches zero.

To set this up, head over to your Shopify admin dashboard and navigate to the “Products” section. Choose the specific product you want to modify and scroll down to the “Inventory” segment. Under “Inventory policy,” opt for “Shopify tracks this product’s inventory” and ensure that the “Continue selling when out of stock” box is checked.

In the “Out of stock message” field, you can craft your custom message. If you’re looking for more advanced features, consider exploring Shopify apps like “Back in Stock” or “Stockify” for additional inventory management capabilities and tailored messaging options.

If there is anything else I can help you with, please let me know.