liquify.

How to add a countdown timer to Shopify product pages

A countdown timer shows how long a sale or offer has left. Used for a real deadline, it helps shoppers decide.

Use it only for real deadlines. Timers that quietly reset for every visitor misrepresent the offer, put off returning customers, and can break consumer protection rules in some countries.

1. Check your theme and current apps

  1. Some paid themes include a countdown or promotion block. Look under Add block in the product information section in Customize.
  2. If you already use a discount or promotion app, check whether it includes a timer you can show on the product page.

2. Add a timer with code

  1. In your Shopify admin, go to Online Store > Themes. On your theme, click the ... menu and choose Duplicate, so you have a backup. Then on the theme you're editing, open the ... menu and choose Edit code.
  2. Create a snippet with the timer markup and a script that counts down to a fixed end date and time.
  3. Render the snippet in the product section near the price or the Add to cart button.
  4. Have the timer hide itself, or switch to a message, once the deadline passes.
A minimal countdown to a fixed date
<p class="countdown" data-end="2026-12-01T00:00:00Z">Sale ends in <span></span></p>
<script>
  document.querySelectorAll(".countdown").forEach((el) => {
    const end = new Date(el.dataset.end).getTime();
    const out = el.querySelector("span");
    const tick = () => {
      const left = end - Date.now();
      if (left <= 0) return el.remove();
      const h = Math.floor(left / 36e5), m = Math.floor((left % 36e5) / 6e4), s = Math.floor((left % 6e4) / 1e3);
      out.textContent = h + "h " + m + "m " + s + "s";
      setTimeout(tick, 1000);
    };
    tick();
  });
</script>

3. Or ask Liquify in one sentence

Liquify is an AI theme editor for Shopify. Type the change in plain words and it edits your theme for you, on a draft copy, with a live preview. Nothing changes on your store until you publish.

“Add a countdown timer on product pages for my sale that ends on December 1”

Try it free on a sample store

Free plan, no credit card. Connect a real store whenever you're ready.

Questions

Do countdown timers increase sales?

They can, when the deadline is real and the offer is worth acting on. Fake or always-resetting timers tend to backfire once shoppers notice.

Can the timer show only on products that are on sale?

Yes. Wrap it in a check for a compare-at price, a product tag, or a metafield so it only appears where the offer applies.

More guides