We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Display units in stock / low inventory on product pages - Dawn Theme

Solved

Display units in stock / low inventory on product pages - Dawn Theme

contactdaiquiri
Pathfinder
91 0 20

Hi everyone,

 

I would like to display the number of units left in stock on product pages when inventory <5 : "ONLY X LEFT."

I have sizes variants, no color. 

 

I would like it to be :

- positioned between the sizes options and the "add to cart" button as in the pink bubble bellow

- in #D0DF00 font color

- same size than the "add to cart"

Is it possible ? Thank you so much!

 

Theme : Dawn 6.0.2

Preview link: https://h78186m8xvkh47hp-66207744226.shopifypreview.com

Screenshot: 

Capture d’écran 2022-11-23 à 18.25.31.png

 

Accepted Solution (1)
BSS-Commerce
Shopify Partner
3478 465 561

This is an accepted solution.

Hi @contactdaiquiri 

 

Please follow these steps:

  • Step 1: Go to Online Store -> Customize theme
  • Step 2: Go to Product page ->  product information -> add block -> custom liquid
  • Step 3: Paste the code to the block
{% if product.variants.first.inventory_quantity < 5 and product.variants.first.inventory_quantity > 0 %}
  <p style="color: #D0DF00; text-align:center">ONLY {{ product.variants.first.inventory_quantity }} LEFT</p>
{% elsif product.variants.first.inventory_quantity < 1 %}
<p style="color: #D0DF00; text-align:center">SOLD OUT</p>
{% endif %}
  • Step 4: Move this block to the after "Buy button"
  • Step 5: Enjoy !!!

I hope that it works for you.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency

View solution in original post

Replies 12 (12)

JavaBird
Shopify Partner
5 0 1

You can try to follow this guide, but apply it for the Dawn theme: https://help.shopify.com/en/manual/online-store/themes/themes-by-shopify/vintage-themes/customizing-...

No BS web development javabird.net

BSS-Commerce
Shopify Partner
3478 465 561

Hi @contactdaiquiri 

 

I would like to give you the solution. You can try it by following these steps:

 

- Step 1: Go to Online Store -> Customize theme

- Step 2: Go to Product page ->  product information -> add block -> custom liquid

- Step 3: Paste this code to the block :

 

{% if product.variants.first.inventory_quantity < 5 %}
  <p style="color: #D0DF00; text-align:center">ONLY {{ product.variants.first.inventory_quantity }} LEFT</p>
{% endif %}

 

- Step 4: Move this block to the after "Buy button."

- Step 5: Enjoy !!!

 

This is our recorded video for you to refer to: https://www.loom.com/share/eb2d9ddc774947d8acc8a01bef9c8e0d

 

Let me know if it works for you by giving us a like or marking it as a solution.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
contactdaiquiri
Pathfinder
91 0 20

Hi @BSS-Commerce ,

 

Once again, thank you, this is amazing. Only thing, I don't want it to show if inventory = 0, because then it displays "only 0 left", I don't need this information since there is already the "sold out". 

 

Can we change the parameter to 0<x<5 ? Thank you so much !

 

Capture d’écran 2022-11-24 à 11.34.55.png

contactdaiquiri
Pathfinder
91 0 20

Hi @BSS-Commerce , 

 

any chance you could kindly check the little issue mentioned bellow? Thank you !! 

Preview link updated: https://c47ucmd0vhexydgy-66207744226.shopifypreview.com

 

BSS-Commerce
Shopify Partner
3478 465 561

This is an accepted solution.

Hi @contactdaiquiri 

 

Please follow these steps:

  • Step 1: Go to Online Store -> Customize theme
  • Step 2: Go to Product page ->  product information -> add block -> custom liquid
  • Step 3: Paste the code to the block
{% if product.variants.first.inventory_quantity < 5 and product.variants.first.inventory_quantity > 0 %}
  <p style="color: #D0DF00; text-align:center">ONLY {{ product.variants.first.inventory_quantity }} LEFT</p>
{% elsif product.variants.first.inventory_quantity < 1 %}
<p style="color: #D0DF00; text-align:center">SOLD OUT</p>
{% endif %}
  • Step 4: Move this block to the after "Buy button"
  • Step 5: Enjoy !!!

I hope that it works for you.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
Graham256
Excursionist
15 0 9

That works great, thanks!

 

I've tried to do this same trick one level higher, in the product grid, but no luck 😞

Is there a way to already show low stock indicators in the collections and other product grids?

jayisrael
Visitor
1 0 0

Hello, I try to add the code, but the value doesn't change when I switch to another variant.

 

Zel_
Shopify Partner
25 0 1

Hi @jayisrael , 

 

You can try HeyMerch low stock counter app, it shows the value based on variants. 

contactdaiquiri
Pathfinder
91 0 20

Hi @BSS-Commerce 

This code is not working anymore... nothing appears. Do you have any idea how to fix it ? I'm still looking to display low inventory "ONLY XX LEFT" for variants < 3 units left.

lunaritycollect
New Member
5 0 0

Hello!
How would you write it to show nothing if count = 0? (aka item is sold out)

nadinecharles
Shopify Partner
3 0 0

Hello BSS_Commerce

 

I am using the native low-stock indicator in the Dawn Theme. Please see attached screenshot: when a variant is out of stock, this is already displayed which is great.

 

All I want to change is to for the low-stock indicator to show when there is 1 left only. How can I change just this?

 

Thanks.

nadinecharles_0-1688467142399.png

 

nadinecharles
Shopify Partner
3 0 0

So sorry. The option is right there in the theme customiser....