Hi everyone,
I’m using the Dawn theme version 15.3.0 and I would like to automatically display a “Last Item” badge on the product page for every product who’s inventory is exactly 1. Do you know how to do this?
For now, I am adding the items that only have one size left manually to a collection that I share on my website. But if visitors are in a brand collection they won’t see which items are “last chances”. So I’d like it to be more clear and visible
Thank you
@LeTrunkshop1 we can edit code to check if product inventory is 1 and put this badge, this will need coding as well as html/css changes
Hey @LeTrunkshop1 ,
Unfortunately, Shopify Dawn theme don’t have the built-in feature to show the badge based on the product Quantity.
For this you need to get assistant from the Developer or you can find my details in the signature below. Because this need to modify your Existing code align with your requirements.
If this was helpful mark as Solution and like it.
Thanks
Hey @LeTrunkshop1 ,
You can achieve this by editing your Dawn theme’s product template to conditionally show a “Last Item” badge when product.selected_or_first_available_variant.inventory_quantity == 1. In your main-product.liquid or product-information.liquid file (depending on your theme structure), insert a conditional block near the product badges or title that checks for this quantity and displays a styled badge. This will automatically show the “Last Item” label whenever the stock hits exactly 1, making it visible on any collection or product page without manually managing a separate collection.
Hi @LeTrunkshop1
Please open price.liquid file, below this line of code
{%- if show_badges -%}
Add this code
{% if product.variants.first.inventory_quantity == 1 %}
Last Item
{% endif %}