Free tool — no app, no accountLow stock badge generator for Shopify
The count is already on your product page: Shopify hands your theme variant.inventory_quantity. This builds the Liquid that prints it, with the two guards that stop it printing a number that means nothing, and the stylesheet it needs. Nothing is installed and nothing is sent anywhere.
Preview
Example product
£24.00 · one size
Only 3 left in stock
Shown when the selected variant has 5 or fewer left, and the store stops selling at zero. The 3 above is a sample: on your store the number is whatever your own inventory holds, and the badge prints nothing when there is nothing true to say.
The Liquid
Paste into snippets/ssm-low-stock.liquid in your theme, or straight into your product template.
{%- comment -%}
Low-stock badge. Generated at wearebooster.com/tools/low-stock
Prints nothing unless Shopify is tracking the stock and the store
stops selling at zero — see the two guards below.
{%- endcomment -%}
{%- assign ssm_threshold = 5 -%}
{%- assign ssm_variant = product.selected_or_first_available_variant -%}
{%- assign ssm_left = ssm_variant.inventory_quantity -%}
{%- if ssm_variant.inventory_management == 'shopify'
and ssm_variant.inventory_policy == 'deny' -%}
{%- if ssm_left > 0
and ssm_left <= ssm_threshold -%}
<p class="ssm-low-stock ssm-low-stock--pill">
Only <span class="ssm-low-stock__count">{{ ssm_left }}</span> left in stock
</p>
{%- endif -%}
{%- endif -%}The style
Add to your theme’s CSS, or to an asset called component-low-stock.css.
/*
Low-stock badge — generated at wearebooster.com/tools/low-stock
Adjust the three colours below to your theme; nothing else here is a
brand colour.
Dark theme: the tint reads as a bright block on near-black. If your
theme is dark, replace the three lines with:
--ssm-accent: #fbbf24;
--ssm-tint: rgba(251, 191, 36, 0.12);
--ssm-edge: rgba(251, 191, 36, 0.3);
*/
.ssm-low-stock {
--ssm-accent: #b45309;
--ssm-tint: #fffbeb;
--ssm-edge: rgba(180, 83, 9, 0.28);
margin: 0.5rem 0;
color: var(--ssm-accent);
font-size: 0.875rem;
line-height: 1.4;
}
.ssm-low-stock__count {
font-weight: 600;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.ssm-low-stock--pill {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.625rem;
border: 1px solid var(--ssm-edge);
border-radius: 999px;
background: var(--ssm-tint);
}What it will and won’t say
The two guards are the reason this snippet is worth more than the others like it. They are not defensive coding — they are what makes the number a fact about your stock instead of a decoration.
inventory_management == 'shopify'
Only when the stock is tracked
A variant set to "don’t track quantity" has no count, and its zero is a default rather than an empty shelf. The badge stays silent instead of announcing a number that was never measured.
inventory_policy == 'deny'
Only when zero is a wall
A store set to keep selling at zero has no limit to announce. Printing "only 3 left" beside a product it will happily sell you at minus two would be the exact thing this site argues against.
inventory_quantity > 0
Zero is the theme’s job
At zero the product page already says sold out. A badge reading "0 left" beside it duplicates the message in a smaller font.
inventory_quantity <= threshold
Only near the end
A badge that is always on stops being a signal. The threshold is what makes the same sentence mean something on the fourth day of a sale.
Every sentence the three tones can print is a restatement of your own inventory number. None of them claims a rate, a restock date, or how many other people are looking — because this snippet cannot know any of those, and a badge that guesses is worse than no badge. The blog has the longer argument.
What it can’t tell you
- It is a snapshot taken when the page rendered. Checkouts reserve stock, so the number can be a minute old by the time a shopper reads it.
- It prints the count for the variant the page loaded with. A theme that swaps variants without a reload needs its own update hook, and this generator does not write JavaScript.
- It stays silent on any product where a variant is untracked or oversells — including, in product scope, if only one of them is.
- It is not evidence that anyone bought anything. That is a claim about orders, and stock levels cannot support it.
Where it goes
1. Make the snippet
Shopify admin → Online Store → Themes → Edit code → Snippets → Add a new snippet. Name it
ssm-low-stockand paste the Liquid above.2. Place it
In your product template, where the price and variant picker are (
sections/main-product.liquidin Dawn and most themes), add:{% render 'ssm-low-stock', product: product %}3. Add the style
Paste the CSS into your theme’s stylesheet, or create
assets/component-low-stock.cssand link it fromtheme.liquid.
To remove it, delete the render line — the snippet and the CSS can stay without printing anything.
Questions
Do I need an app, an API key, or a Shopify token?
No. Shopify prints variant.inventory_quantity into your product template as Liquid, so the badge is rendered by your theme along with the rest of the page. There is no app to install, no token to paste, and nothing is requested from another server.
Why does the badge show nothing on some products?
One of four guards is stopping it. The variant's stock has to be tracked (not “don't track quantity”), the store has to stop selling at zero, the count has to be above zero, and it has to be at or below your threshold. In product mode it also stays silent if any single variant is untracked or allowed to oversell, because then the total is not a limit.
Is the number accurate?
It is your own inventory count at the moment the page rendered. Checkouts reserve stock, so it can be slightly stale by the time a shopper reads it. It is not an estimate and it is not a prediction — it is the same figure your Shopify admin shows.
Does it update when a shopper picks a different size?
No. It prints the count for the variant your product page loaded with. A theme that swaps variants without a reload needs its own update hook, and this generator deliberately does not write JavaScript — a wrong script on a live product page is worse than no badge.
Where do I paste the code?
Shopify admin → Online Store → Themes → Edit code. Add the Liquid as a snippet named ssm-low-stock, place it with a render tag in your product template, and add the CSS to your theme's stylesheet. The three steps are on the page, with the files to look for by name.
Does it work on collection pages and search results?
No. Those cards do not carry the full product object this snippet reads, and on a card the count would be for one variant rather than the one a shopper is looking at. Product pages and quick-view modals are the right places.
Will it slow my page down?
No. It is Liquid rendered with the HTML your theme already sends, so it adds no request, no script and no layout shift.
If the number should come from your orders instead of your shelf
Low stock is a count of what is left. “23 sold today” is a count of what happened, and it is the one this app prints — from your own store data, on the product page, in the free plan.