Back to Shopify Liquid
Super Deals
Shopify Liquid

Super Deals

Adds a promotional red banner with an automated 12-hour countdown timer and pulsing animation. The timer includes an auto-reset function to maintain urgency for perpetual flash sales.

EasyHigh UrgencyFlash SaleCountdown TimerCROPromotion Banner
97 lines · 3.2 KB
Setup 5–10 minutes 5 min read 96 lines
Key features
  • Automated 12-hour reset loop
  • Pulsing CSS scale animation
  • Responsive flexbox layout
  • Custom Google Font integration
Best use cases
  • Flash sale pages to drive immediate action
  • Product page urgency for limited-time offers
  • Site-wide promotion bars for daily deals
Compatibility
  • Most Shopify themes
  • Shopify Online Store 2.0

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>SuperDeals Banner</title>
7 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@700&family=Oswald:wght@700&display=swap" rel="stylesheet">
8 <style>
9 .unique-body-Abc123 {
10 font-family: Arial, sans-serif;
11 background-color: #f0f2f5;
12 margin: 0;
13 padding: 20px;
14 }
15
16 .unique-deal-banner-Abc123 {
17 display: flex;
18 border-radius: 15px;
19 overflow: hidden;
20 font-family: 'Arial', sans-serif;
21 font-size: 14px;
22 }
23
24 .unique-deal-text-container-Abc123 {
25 background-color: #ff4d4d; /* Bir ton koyu kırmızı */
26 padding: 10px 20px;
27 display: flex;
28 align-items: center;
29 }
30
31 .unique-deal-text-Abc123 {
32 font-family: 'Roboto', sans-serif;
33 font-weight: 700;
34 color: white; /* Metin rengi beyaz */
35 }
36
37 .unique-deal-timer-container-Abc123 {
38 background-color: #ff6666; /* Açık kırmızı */
39 padding: 10px 20px;
40 display: flex;
41 align-items: center;
42 justify-content: center;
43 flex-grow: 1;
44 }
45
46 .unique-deal-timer-Abc123 {
47 font-family: 'Oswald', sans-serif;
48 font-size: 16px;
49 font-weight: 700;
50 color: white;
51 animation: unique-timerAnimation-Abc123 1s ease-in-out infinite alternate;
52 }
53
54 @keyframes unique-timerAnimation-Abc123 {
55 0% { transform: scale(1); }
56 100% { transform: scale(1.1); }
57 }
58 </style>
59</head>
60<body class="unique-body-Abc123">
61 <div class="unique-deal-banner-Abc123">
62 <div class="unique-deal-text-container-Abc123">
63 <span class="unique-deal-text-Abc123">SuperDeals</span>
64 </div>
65 <div class="unique-deal-timer-container-Abc123">
66 <span class="unique-deal-timer-Abc123" id="countdown">Ends: 9d : 18 : 22 : 13</span>
67 </div>
68 </div>
69
70 <script>
71 function startCountdown() {
72 var countDownTime = 12 * 60 * 60 * 1000; // 12 hours in milliseconds
73 var countDownDate = new Date().getTime() + countDownTime;
74
75 var x = setInterval(function() {
76 var now = new Date().getTime();
77 var distance = countDownDate - now;
78
79 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
80 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
81 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
82 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
83
84 document.getElementById("countdown").innerHTML = "Ends: " + days + "d : " + hours + " : " + minutes + " : " + seconds;
85
86 if (distance < 0) {
87 clearInterval(x);
88 startCountdown(); // Restart the countdown
89 }
90 }, 1000);
91 }
92
93 startCountdown();
94 </script>
95</body>
96</html>

How to install Super Deals on your Shopify theme

This snippet belongs in sections/announcement-bar.liquid (or the top of layout/theme.liquid), directly above your header so it renders on every page. 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/announcement-bar.liquid (or the top of layout/theme.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 above your header so it renders on every page.
  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 Super Deals to your brand without touching the rest of the theme.

  • Colours — the snippet uses #f0f2f5, #ff4d4d, #ff6666. 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 (14px, 16px) and the padding so the block carries the same visual weight as the elements around it.
  • Cornersborder-radius: 15px controls the roundness. Set it to 0 for a sharper editorial look, or increase it for a softer, app-like feel.
  • Copy — rewrite the hard-coded text (for example “SuperDeals Banner”) in your own brand voice, and translate it if you sell in more than one language.
  • Timing — the countdown duration is set in the script. Change the target time or the interval value to control how long the offer runs before it resets.

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/announcement-bar.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.
  • Running a countdown that resets on every page load and never actually expires. Shoppers notice fake urgency, and in the EU and UK it can breach consumer-protection rules.
  • 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.
  • The animation runs on CSS keyframes. Animate only transform and opacity where you can — animating width, height or top forces a layout recalculation on every frame.
  • 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.
  • 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

Super Deals — 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/announcement-bar.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 “Super Deals” 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