Adding a "low in stock" label to a product image

Solved
Highlighted
Tourist
11 0 1

Hi everyone. I am wanting to add a "low in stock" label to products which have less than 2 items left in stock. Same as when a product is sold out it has the "sold out" label underneath the image of the product in collections. Does anyone know how I can put that "low in stock" label for my products? Thanks!

0 Likes
Shopify Partner
1025 214 467

@Peppalane12 

 

You can use the following code:

{% if product.first_available_variant.inventory_quantity < 2 %}<div>low in stock</div>{% endif %}

 

Thank you,

Tejas 

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
Highlighted
Tourist
11 0 1

Hi @Tejas_Nadpara, thanks for replying! Where do I put that code? In the product snippet?

0 Likes
Highlighted
Shopify Partner
1025 214 467

@Peppalane12 

 

It depends on theme. Which theme you are using?

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
Highlighted
Tourist
11 0 1

@Tejas_Nadpara I'm using Retina by Out of the Sandbox! 

0 Likes
Highlighted
Shopify Partner
2294 117 356

If you need these labels in the literal images so they work multichannel modemagic can edit images automatically https://apps.shopify.com/modemagic

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
Highlighted
Shopify Partner
1025 214 467

This is an accepted solution.

@Peppalane12 

 

You can add in product-thumbnail.liquid file.

almost-soldout.png

 

Cheers,

Tejas

 

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
1 Like
Highlighted
New Member
6 0 0

Hello, 

 

Sorry to gatecrash the thread - would this work on the Brooklyn theme, and if so where would i put the code please?

 

Thanks in advance. 

 

Simon

0 Likes
Highlighted
Shopify Partner
1025 214 467

@Simon_Brindle 

 

Yes, It will work on the Brooklyn theme as well.

Send me an email with your store URL, I will help you to put it on correct place.

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
Highlighted
New Member
6 0 0
That's great - thanks so much for your very kind help.

clairabow.co.uk

Simon

0 Likes