Skip to content
  1. Home
  2. Countdown timer guides for Shopify stores
Guide

Coding a Shopify countdown timer yourself vs adding one without code

You can build a countdown timer on Shopify without an app: store the deadline in a metafield, print it with Liquid and count down with a few lines of JavaScript. For one product with one fixed date, that's a reasonable afternoon's work. It gets harder once you want it to follow a discount, hide on time, appear on collection pages and survive theme updates. Here's an honest look at both routes.

Updated ·6 min read

What a DIY Liquid + JavaScript timer involves

This is the approach a developer would usually take on an Online Store 2.0 theme. It's described in steps rather than as copy-paste code, because the exact markup depends on your theme.

  1. Back up the themeDuplicate your live theme before changing anything, so you can roll back. Code changes go live as soon as you save them on the published theme.
  2. Store the deadline in a metafieldCreate a product metafield definition (Add definition) with the type Date and time, for example named "Sale ends". Shopify stores this value in ISO 8601 format in UTC. Then fill in the date and time on each product that should show a timer.
  3. Print it with LiquidOn the product page, add a Custom Liquid block in the theme editor (or edit the product section's code). Inside it, check that the metafield has a value, and only then output an empty container element that carries the deadline as a data attribute. Convert the date to a Unix timestamp with Liquid's date filter and the %s format so JavaScript can read it as a plain number.
  4. Count down with JavaScriptAdd a small script that finds the container, reads the timestamp, multiplies it by 1,000 to get milliseconds and subtracts the current time from Date.now(). Every second (setInterval with 1,000 ms), split the remaining milliseconds into days, hours, minutes and seconds with whole-number division and write them into the container.
  5. Hide it when time runs out, in JavaScriptWhen the remaining time reaches zero, stop the interval and remove the container. Run the same check as soon as the script loads, so a deadline that passed earlier never flashes on screen. Don't rely on Liquid's 'now' to hide it: Shopify's documentation notes that 'now' reflects when the Liquid was last rendered and might not update on every page view because of caching.
  6. Style and test itAdd CSS that uses your theme's fonts and colours, wrap any animation in a prefers-reduced-motion media query, and test on a phone, on a product without the metafield, and after the deadline passes.
About time zonesThe metafield holds an absolute moment in UTC and Date.now() is also absolute, so every shopper sees the correct time remaining, wherever they are. Time zones only bite in two places: when you enter the date (check which time zone the admin is showing; your store's time zone is set in Settings → General), and in any text like "ends at midnight", which should name the time zone. One weakness of any browser-side timer: if a shopper's device clock is wrong, their countdown is wrong too.

Where DIY timers usually break

  • Two dates for one deadline. The timer reads your metafield; the discount has its own dates in Discounts. Change one and forget the other, and the timer shows a deadline that isn't true. Liquid's discount objects describe what's applied to a cart, not a discount's schedule, so the usual DIY fix is discipline, not code.
  • Many products. A metafield per product is fine for five products and tedious for 300. You'd need bulk editing, or code that reads a date from a collection or a theme setting instead.
  • Collection pages. Badges on product cards mean editing the theme's product card snippet, which appears on collection pages, search results and home page sections, each with its own layout quirks.
  • Theme updates. Shopify's help docs say code edits are carried into a theme update only if they don't conflict with it; otherwise the update reports that code edits couldn't be included and you copy them over yourself.
  • Hand-over. Whoever wrote the code is the only one who can change it confidently. Six months later, a new sale date means opening theme files again.

DIY vs a no-code app

Coded in Liquid + JSQuickOff (no code)
SetupA few hours for one product page timer, more for cardsCreate a timer, add the app block, turn on the embed
Follows a Shopify discountNo, you keep dates in sync by handYes: reads the discount's start and end, follows changes
Which productsWhatever you code: per-product metafields or custom logicAll, specific products or specific collections
Collection page badgesEdit the card snippetApp embed, switched on once
Hides when it endsOnly if you code itAutomatically
Theme updatesCode edits may need copying overApp block and embed are managed in the theme editor, not theme files
Daily recurring, country targetingSignificant extra codePro (daily recurring) and Plus (country targeting)
CostYour or a developer's timeFree plan (2 timers); Pro $7.99/month

The no-code route with QuickOff

  1. Install and create a timerInstall QuickOff from the Shopify App Store and create a timer: an end date, a Shopify discount to follow, fixed minutes per visitor, or daily recurring (Pro).
  2. Choose products and textPick the products or collections, write the title and sub-heading, and keep the Match my theme style so the timer uses your theme's fonts, colours and corner radius.
  3. Place itIn Online Store → Edit theme, add the QuickOff app block to the product page with Add block → Apps, and switch on the app embed under App embeds for product card badges. Full walkthrough: add a timer to product pages.
  4. PublishThe timer goes live, and it disappears by itself when it ends. If you sync it to a discount, change the discount's dates and the timer follows. See discount-synced timers.

On performance, the two routes are closer than people expect. QuickOff places the timer's data in the page through an app metafield, so the storefront makes no extra calls to QuickOff's servers, and it loads one small script. Details in will a timer slow down my store?.

When coding it yourself makes sense

  • You have a developer who already maintains your theme and is happy to own the code.
  • You need one timer on one template with a date that rarely changes, like a yearly event.
  • You want behaviour no app offers and are prepared to maintain it through theme updates.

Whichever route you choose, the deadline must be real. A coded timer that resets on every visit is just as misleading as an app that does it; see our guide to honest urgency.

Skip the theme codeAdd a product page timer and card badges without editing theme files. Free plan available.
Install free on Shopify

Frequently asked questions

Can I add a countdown timer to Shopify without an app?

Yes. Store the deadline in a Date and time metafield, output it in a Custom Liquid block on the product page and count down with a short JavaScript snippet. It works well for simple cases; it doesn't follow your discounts or hide itself unless you code that.

Why does my Liquid countdown show the wrong time or stay up after the deadline?

Liquid's 'now' is the time the page was last rendered, which can be cached, so it's not reliable for live countdowns. Do the counting and the hiding in JavaScript in the shopper's browser.

Will a theme update remove my custom timer code?

Not necessarily. Shopify carries code edits into an update when they don't conflict with it. When they do conflict, the update says the edits couldn't be included and you need to copy them over. Keep a copy of your code.

Do timer apps edit my theme code?

QuickOff doesn't need you to edit theme files. It's added through an app block on the product page and an app embed for product cards, both managed in the theme editor.

Is a coded timer faster than an app?

A well-written coded timer is light. QuickOff is built to be light too: timer data sits in the page itself, there are no extra calls to QuickOff's servers, and it loads one small script.

Add a timer your shoppers can trust

Pick a Shopify discount, and QuickOff shows a countdown that starts, moves and ends with it, styled like the rest of your store.

Install free on ShopifyPaid plans include a 14-day free trial