
Scarcity sells. ‘Only 3 left in stock’ creates genuine urgency that pushes hesitant shoppers to buy now instead of ‘thinking about it’ (which usually means never). This Liquid snippet reads your REAL inventory quantity and shows the alert only when stock is low. Six designs, zero apps, pure copy-paste.
1. Fashion Store – Urgent Stock Alert
Red alert styling for apparel scarcity.
Preview
Sample: shows automatically when stock drops below your limit (Liquid reads real inventory).
🔥 Selling fast! Only 3 left in stock — order soon!
Liquid Code
{% assign inv = product.selected_or_first_available_variant.inventory_quantity %}
{% if inv > 0 and inv <= 10 %}
<div class="lk-stock" style="font-family:Arial, sans-serif;">
<span class="lk-dot"></span>
<strong>🔥 Selling fast!</strong> Only {{ inv }} left in stock — order soon!
</div>
<style>
.lk-stock {
display:flex; align-items:center; gap:8px;
background:#fef2f2; color:#7f1d1d; border:1px solid #dc2626;
border-radius:8px; padding:10px 14px; margin:12px 0; font-size:14px;
}
.lk-dot {
width:10px; height:10px; border-radius:50%; background:#dc2626;
animation: lk-pulse 1.2s infinite;
}
@keyframes lk-pulse {
0% { box-shadow: 0 0 0 0 #dc262666; }
70% { box-shadow: 0 0 0 8px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
</style>
{% endif %}
2. Electronics Store – Low Stock Warning
Amber tech warning for gadgets.
Preview
Sample: shows automatically when stock drops below your limit (Liquid reads real inventory).
⚠️ Low stock! Only 3 left in stock — order soon!
Liquid Code
{% assign inv = product.selected_or_first_available_variant.inventory_quantity %}
{% if inv > 0 and inv <= 5 %}
<div class="lk-stock" style="font-family:'Segoe UI', sans-serif;">
<span class="lk-dot"></span>
<strong>⚠️ Low stock!</strong> Only {{ inv }} left in stock — order soon!
</div>
<style>
.lk-stock {
display:flex; align-items:center; gap:8px;
background:#fffbeb; color:#78350f; border:1px solid #d97706;
border-radius:6px; padding:10px 14px; margin:12px 0; font-size:14px;
}
.lk-dot {
width:10px; height:10px; border-radius:50%; background:#d97706;
animation: lk-pulse 1.2s infinite;
}
@keyframes lk-pulse {
0% { box-shadow: 0 0 0 0 #d9770666; }
70% { box-shadow: 0 0 0 8px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
</style>
{% endif %}
3. Limited Edition – Exclusive Scarcity
Black-gold exclusive drop styling.
Preview
Sample: shows automatically when stock drops below your limit (Liquid reads real inventory).
💎 Almost gone! Only 3 left in stock — order soon!
Liquid Code
{% assign inv = product.selected_or_first_available_variant.inventory_quantity %}
{% if inv > 0 and inv <= 15 %}
<div class="lk-stock" style="font-family:Georgia, serif;">
<span class="lk-dot"></span>
<strong>💎 Almost gone!</strong> Only {{ inv }} left in stock — order soon!
</div>
<style>
.lk-stock {
display:flex; align-items:center; gap:8px;
background:#111111; color:#f5e6c4; border:1px solid #c9a227;
border-radius:4px; padding:10px 14px; margin:12px 0; font-size:14px;
}
.lk-dot {
width:10px; height:10px; border-radius:50%; background:#c9a227;
animation: lk-pulse 1.2s infinite;
}
@keyframes lk-pulse {
0% { box-shadow: 0 0 0 0 #c9a22766; }
70% { box-shadow: 0 0 0 8px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
</style>
{% endif %}
4. Grocery Store – Fresh Stock Alert
Green restock-style alert for perishables.
Preview
Sample: shows automatically when stock drops below your limit (Liquid reads real inventory).
🌱 Going fast! Only 3 left in stock — order soon!
Liquid Code
{% assign inv = product.selected_or_first_available_variant.inventory_quantity %}
{% if inv > 0 and inv <= 12 %}
<div class="lk-stock" style="font-family:Verdana, sans-serif;">
<span class="lk-dot"></span>
<strong>🌱 Going fast!</strong> Only {{ inv }} left in stock — order soon!
</div>
<style>
.lk-stock {
display:flex; align-items:center; gap:8px;
background:#f2f9ec; color:#1b4d1e; border:1px solid #2e7d32;
border-radius:10px; padding:10px 14px; margin:12px 0; font-size:14px;
}
.lk-dot {
width:10px; height:10px; border-radius:50%; background:#2e7d32;
animation: lk-pulse 1.2s infinite;
}
@keyframes lk-pulse {
0% { box-shadow: 0 0 0 0 #2e7d3266; }
70% { box-shadow: 0 0 0 8px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
</style>
{% endif %}
5. Beauty Store – Glam Scarcity
Pink pulsing alert for cosmetics.
Preview
Sample: shows automatically when stock drops below your limit (Liquid reads real inventory).
✨ Hurry! Only 3 left in stock — order soon!
Liquid Code
{% assign inv = product.selected_or_first_available_variant.inventory_quantity %}
{% if inv > 0 and inv <= 8 %}
<div class="lk-stock" style="font-family:'Trebuchet MS', sans-serif;">
<span class="lk-dot"></span>
<strong>✨ Hurry!</strong> Only {{ inv }} left in stock — order soon!
</div>
<style>
.lk-stock {
display:flex; align-items:center; gap:8px;
background:#fdf2f7; color:#6d2d4d; border:1px solid #ec4899;
border-radius:16px; padding:10px 14px; margin:12px 0; font-size:14px;
}
.lk-dot {
width:10px; height:10px; border-radius:50%; background:#ec4899;
animation: lk-pulse 1.2s infinite;
}
@keyframes lk-pulse {
0% { box-shadow: 0 0 0 0 #ec489966; }
70% { box-shadow: 0 0 0 8px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
</style>
{% endif %}
6. Sneaker Store – Hype Drop Counter
Streetwear hype styling for sneaker drops.
Preview
Sample: shows automatically when stock drops below your limit (Liquid reads real inventory).
🔥 HYPE! Only 3 left in stock — order soon!
Liquid Code
{% assign inv = product.selected_or_first_available_variant.inventory_quantity %}
{% if inv > 0 and inv <= 20 %}
<div class="lk-stock" style="font-family:'Arial Black', sans-serif;">
<span class="lk-dot"></span>
<strong>🔥 HYPE!</strong> Only {{ inv }} left in stock — order soon!
</div>
<style>
.lk-stock {
display:flex; align-items:center; gap:8px;
background:#0a0a0a; color:#ffffff; border:1px solid #22ff88;
border-radius:4px; padding:10px 14px; margin:12px 0; font-size:14px;
}
.lk-dot {
width:10px; height:10px; border-radius:50%; background:#22ff88;
animation: lk-pulse 1.2s infinite;
}
@keyframes lk-pulse {
0% { box-shadow: 0 0 0 0 #22ff8866; }
70% { box-shadow: 0 0 0 8px transparent; }
100% { box-shadow: 0 0 0 0 transparent; }
}
</style>
{% endif %}
How to Add Stock Counter to Shopify
No theme file editing needed. Use Shopify’s Custom Liquid section:
- In Shopify admin, go to Online Store > Themes.
- Click Customize on your live theme (works with Dawn and all OS 2.0 themes).
- Navigate to your product page template using the top page selector.
- In the left sidebar, click Add section and choose Custom liquid.
- Paste the code from any variation above into the Custom liquid box.
- Drag the section to the right position (under the buy buttons is ideal) and click Save.
Tip: want it on every product automatically? Add the section once to the default product template and it appears store-wide.
Customize the Stock Counter
- Change the stock limit (e.g. show alert when ≤ 10 units).
- Requires inventory tracking enabled on the product in Shopify admin.
- Edit the urgency message to match your brand voice.
- Adjust the pulse animation speed or remove it for a calmer look.
More Shopify Code Sections
- Shopify Product Page Discount Banner
- Shopify Product Page Custom Offer Box
- Shopify Cart Countdown Timer
- Shopify Product Page Trust Badges with Liquid (Code + Guide)
- Shopify Animated Sale Announcement Bar
- Shopify Product Page Pincode Delivery Checker
- Shopify Frequently Bought Together Section
- Shopify Countdown Announcement Bar
Conclusion
Real scarcity beats fake urgency every time. Because this counter reads live inventory, customers learn to trust it — and act on it. Enable inventory tracking, paste your variation, and let low stock sell for you.
Want this done for you? LayoutKart builds conversion-ready Shopify stores with all these sections pre-installed. Browse our readymade Shopify templates or get a custom store built for your brand.