Back to Shopify Liquid
Hurry up & items sold
Shopify Liquid

Hurry up & items sold

Displays a rotating sequence of social proof notifications featuring real-time simulated counters. It uses JavaScript to animate entry transitions and randomly increment values for items sold, cart additions, and favorites to create a sense of high demand and urgency.

EasyCROSocial ProofUrgency SeniorityProduct PageSales
164 lines · 6.3 KB
Setup 5–10 minutes 5 min read 163 lines
Key features
  • Animated entry transitions
  • Simulated real-time counters
  • Rotating notification carousel
  • Custom SVG iconography
  • Dynamic value incrementation
Best use cases
  • Increasing conversion rates on high-traffic product pages
  • Creating a sense of popularity for trending products
  • Simulating live store activity to build buyer confidence
Compatibility
  • Shopify Online Store 2.0
  • Most Shopify themes

The code

Shopify Liquid
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Notifications</title>
7 <style>
8 .notification-unique-1 {
9 display: none; /* Başlangıçta gizli */
10 align-items: center;
11 font-family: Arial, sans-serif;
12 font-size: 16px;
13 color: #333;
14 margin: 10px 0; /* Yukarı ve aşağı 10 px boşluk ekleme */
15 opacity: 0;
16 transform: translateY(20px); /* Başlangıç pozisyonu */
17 transition: opacity 0.5s, transform 0.5s; /* Geçiş animasyonu */
18 }
19 .notification-unique-1.show {
20 display: flex; /* Görünür olduğunda flex */
21 opacity: 1;
22 transform: translateY(0); /* Son pozisyon */
23 }
24 .icon-unique-1 {
25 margin-right: 5px; /* Metne daha yakın yapmak için azaltıldı */
26 }
27 .icon-unique-1 img {
28 width: 24px; /* İkonun boyutu büyütüldü */
29 }
30 .text-unique-1 {
31 font-weight: normal;
32 }
33 .highlight-unique-1 {
34 color: #008000; /* Koyu yeşil renk */
35 font-weight: bold;
36 transition: all 0.5s ease-out;
37 }
38
39 .notification-unique-2 {
40 display: none; /* Başlangıçta gizli */
41 align-items: center;
42 font-family: Arial, sans-serif;
43 font-size: 16px;
44 color: #333;
45 margin: 10px 0; /* Yukarı ve aşağı 10 px boşluk ekleme */
46 opacity: 0;
47 transform: translateY(20px); /* Başlangıç pozisyonu */
48 transition: opacity 0.5s, transform 0.5s; /* Geçiş animasyonu */
49 }
50 .notification-unique-2.show {
51 display: flex; /* Görünür olduğunda flex */
52 opacity: 1;
53 transform: translateY(0); /* Son pozisyon */
54 }
55 .icon-unique-2 {
56 margin-right: 5px; /* Metne daha yakın yapmak için azaltıldı */
57 }
58 .icon-unique-2 img {
59 width: 24px; /* İkonun boyutu büyütüldü */
60 }
61 .text-unique-2 {
62 font-weight: normal;
63 }
64 .highlight-unique-2 {
65 color: #008000; /* Koyu yeşil renk */
66 font-weight: bold;
67 transition: all 0.5s ease-out;
68 }
69
70 .notification-unique-3 {
71 display: none; /* Başlangıçta gizli */
72 align-items: center;
73 font-family: Arial, sans-serif;
74 font-size: 16px;
75 color: #333;
76 margin: 10px 0; /* Yukarı ve aşağı 10 px boşluk ekleme */
77 opacity: 0;
78 transform: translateY(20px); /* Başlangıç pozisyonu */
79 transition: opacity 0.5s, transform 0.5s; /* Geçiş animasyonu */
80 }
81 .notification-unique-3.show {
82 display: flex; /* Görünür olduğunda flex */
83 opacity: 1;
84 transform: translateY(0); /* Son pozisyon */
85 }
86 .icon-unique-3 {
87 margin-right: 5px; /* Metne daha yakın yapmak için azaltıldı */
88 }
89 .icon-unique-3 img {
90 width: 24px; /* İkonun boyutu büyütüldü */
91 }
92 .text-unique-3 {
93 font-weight: normal;
94 }
95 .highlight-unique-3 {
96 color: #008000; /* Koyu yeşil renk */
97 font-weight: bold;
98 transition: all 0.5s ease-out;
99 }
100 </style>
101</head>
102<body>
103 <!-- Ana Kod -->
104 <div class="notification-unique-1" id="notification-1">
105 <div class="icon-unique-1">
106 <img src="https://www.svgrepo.com/show/434246/rocket.svg" alt="Rocket Icon">
107 </div>
108 <span class="text-unique-1">Hurry up! <span class="highlight-unique-1" id="items-sold">500+</span> items have been sold</span>
109 </div>
110
111 <!-- Varyasyon 1 -->
112 <div class="notification-unique-2" id="notification-2">
113 <div class="icon-unique-2">
114 <img src="https://www.svgrepo.com/show/521847/shopping-cart.svg" alt="Shopping Cart Icon">
115 </div>
116 <span class="text-unique-2"><span class="highlight-unique-2" id="people-cart">11.9B</span> people have it in their cart.</span>
117 </div>
118
119 <!-- Varyasyon 2 -->
120 <div class="notification-unique-3" id="notification-3">
121 <div class="icon-unique-3">
122 <img src="https://www.svgrepo.com/show/477386/love-2.svg" alt="Heart Icon">
123 </div>
124 <span class="text-unique-3">Loved product! <span class="highlight-unique-3" id="people-favorited">1.1M</span> favorited it!</span>
125 </div>
126
127 <script>
128 let notifications = document.querySelectorAll('.notification-unique-1, .notification-unique-2, .notification-unique-3');
129 let index = 0;
130
131 function showNextNotification() {
132 notifications.forEach(notification => notification.classList.remove('show')); // Tüm bildirimleri gizle
133 notifications[index].classList.add('show'); // Geçerli bildirimi göster
134 index = (index + 1) % notifications.length; // Sonraki bildirim için indeksi güncelle
135 setTimeout(showNextNotification, 2000); // 2 saniye sonra bir sonraki bildirimi göster
136 }
137
138 // İlk bildirimi göster
139 showNextNotification();
140
141 // Sayıları artırma fonksiyonu
142 function incrementCounter(elementId, startValue, minIncrement, maxIncrement, minInterval, maxInterval) {
143 let element = document.getElementById(elementId);
144 let value = startValue;
145
146 function updateCounter() {
147 let incrementValue = Math.floor(Math.random() * (maxIncrement - minIncrement + 1)) + minIncrement;
148 value += incrementValue;
149 element.textContent = value.toLocaleString(); // Sayıyı formatla
150 let interval = Math.floor(Math.random() * (maxInterval - minInterval + 1)) + minInterval;
151 setTimeout(updateCounter, interval); // Rastgele bir aralıkta güncelle
152 }
153
154 updateCounter();
155 }
156
157 // Her bir bildirimi artır (rastgele artış ve aralıklar)
158 incrementCounter('items-sold', 500, 1, 10, 1000, 5000); // Çok yavaş artan küçük artışlar
159 incrementCounter('people-cart', 11900000000, 1000, 100000, 500, 2000); // Orta hızda artan büyük artışlar
160 incrementCounter('people-favorited', 1100000, 10, 100, 200, 1000); // Yavaş artan orta artışlar
161 </script>
162</body>
163</html>

How to install Hurry up & items sold on your Shopify theme

This snippet belongs in sections/main-product.liquid, directly under the Add to cart button, where it reinforces the purchase decision. Expect the whole job to take about 5–10 minutes.

  1. 1From your Shopify admin, open Online Store → Themes, click the button on your live theme and choose Duplicate. Always work on a copy so you can roll back instantly.
  2. 2On the duplicated theme, click … → Edit code to open the theme code editor.
  3. 3Open sections/main-product.liquid in the file tree. If your theme uses different file names, search for the template that renders the area where you want the block to show up.
  4. 4Click Copy code on this page, then paste the snippet directly under the Add to cart button, where it reinforces the purchase decision.
  5. 5The snippet ships with its own scoped <style> block, so you do not need to touch base.css or theme.css. If you prefer to keep CSS centralised, move the contents of the style tag into your theme stylesheet and delete the inline block.
  6. 6Keep the <script> tag at the end of the snippet. It only runs once the surrounding markup exists in the DOM, so moving it higher up the file can break the behaviour.
  7. 7Click Save, then hit Preview and check the block on desktop, tablet and mobile widths.
  8. 8When you are happy with the result, publish the duplicated theme from Online Store → Themes → Actions → Publish.

How to customise it

Every value below lives inside the snippet, so you can adapt Hurry up & items sold to your brand without touching the rest of the theme.

  • Colours — the snippet uses #333, #008000. Replace those values inside the style block with your brand palette, keeping at least a 4.5:1 contrast ratio between text and background so the block stays accessible.
  • Typography — the block declares font-family: Arial, sans-serif. Delete that line to inherit your theme font instead, which usually looks better integrated.
  • Sizing — adjust the font-size values (16px) and the padding so the block carries the same visual weight as the elements around it.
  • Images — replace the placeholder image URLs with your own assets. Upload them under Content → Files in Shopify admin and use the generated CDN URL, or reference a theme asset with {{ 'my-image.png' | asset_url }}.
  • Copy — rewrite the hard-coded text (for example “Notifications”) in your own brand voice, and translate it if you sell in more than one language.

Common mistakes to avoid

These are the issues merchants run into most often when installing a snippet like this one.

  • Editing the live theme directly. Duplicate it first — a single unbalanced Liquid tag can take a storefront down mid-campaign.
  • Pasting the code into the wrong file. Dropped into layout/theme.liquid instead of sections/main-product.liquid, this block will render on every page of the store, including ones where it makes no sense.
  • Renaming the CSS classes in the markup but not in the style block, or vice versa. The class names have to match exactly or the styling silently disappears.
  • Adding the snippet twice on the same page. The script targets its selector, so two copies can conflict or double-fire.
  • Leaving the demo images in place. They are hosted on third-party domains, can disappear at any time and slow the page down. Re-upload them to Shopify Files before going live.
  • Publishing without testing on a real phone. Most Shopify traffic is mobile, and layout problems almost always surface there first.

Performance notes

What this block costs you in load time, and how to keep that cost at zero.

  • The CSS is inline and scoped to this block, so it adds no extra network request. At a few kilobytes it has no measurable effect on your Lighthouse score.
  • The JavaScript is vanilla — no jQuery, no external library, no additional request. Keep it after the markup so it never blocks rendering.
  • Add loading="lazy" plus explicit width and height attributes to every image in the snippet. That prevents Cumulative Layout Shift, which is a Core Web Vitals ranking factor.
  • Third-party image URLs bypass the Shopify CDN and add extra DNS lookups. Self-hosting those assets usually saves 100–300ms on first paint.
  • Run PageSpeed Insights before and after you add the block so you have a concrete number rather than a guess.

SEO & accessibility

How to add this block without damaging your on-page structure or your rich results.

  • Nothing in this snippet should replace your page <h1>. Keep product and page headings intact and use <h2> or <h3> for the block's own heading so the document outline stays clean.
  • Write a descriptive alt attribute for every image. Empty or generic alt text is one of the most common accessibility and SEO issues on Shopify stores.
  • If the block shows review or rating content, keep it consistent with the structured data your review app already outputs. Duplicating or contradicting rating markup can cost you the rich result entirely.
  • The block does not create a new URL, so there is no canonical or indexing change to make. It improves on-page engagement signals rather than crawlability.
Frequently asked questions

Hurry up & items sold — questions merchants ask

Will this snippet work with my theme?

It is built with standard Liquid, HTML and CSS, so it works with Dawn and virtually every Online Store 2.0 theme, as well as most vintage themes. The only thing that changes between themes is the file you paste it into — if yours has no sections/main-product.liquid, look for the equivalent template that renders the same area.

Do I need an app to use it?

No. This is theme code you own outright: no monthly fee, no third-party script tag, and no app that can break your storefront the next time it updates.

How long does it take to add “Hurry up & items sold” to a store?

Most merchants have it live in under fifteen minutes — duplicate the theme, paste the code, adjust the colours and copy, preview on mobile, publish.

The block appears but nothing happens. What is wrong?

That is almost always a script-order problem. Check that the script tag is still at the bottom of the snippet and that the markup was not pasted inside another script or a Liquid comment block. Open your browser console and look for an error naming the snippet's selector.

The styling looks broken after pasting. How do I fix it?

Confirm you copied the whole snippet including the closing style tag, then check whether one of your theme's own CSS rules is overriding it. If a theme rule wins, increase the specificity of the snippet's selector rather than scattering !important through the file.

Will it slow my store down?

Not meaningfully. It is inline markup with scoped CSS and at most a few lines of vanilla JavaScript — no external libraries, no extra HTTP request. Optimising your product images will always have a far bigger impact on load time.

Can I use it on a client store or a commercial project?

Yes. Every snippet in the MCO Hub library is free to copy, modify and ship on any store, including client work. Attribution is appreciated but not required.

Related snippets

Keep exploring