All guides › Schedule announcement bar messages

Schedule your Shopify announcement bar with start and end dates

Disclosure: I build No-App Sections; this guide was written with AI assistance. The code on this page was written for this guide. It passes Shopify's Theme Check inside Dawn 16.0.0 and automated tests in headless Chrome, run against Dawn's own cart and variant events with mocked store data. It hasn't been run on a live store yet, so try it on a duplicate theme first.

Dawn's announcement bar has no dates. If your Black Friday message should start at midnight on Friday and your "closed until 4 January" notice at noon on Christmas Eve, someone has to be awake to change it. This section takes a short schedule, written once, and shows whichever message is live right now.

The schedule format

One message per line, four parts separated by |:

start | end | message | link (optional)

For example:

2026-11-27T00:00:00+00:00 | 2026-12-01T00:00:00+00:00 | Black Friday weekend: 20% off everything | /collections/all
2026-12-01T00:00:00+00:00 | 2026-12-17T14:00:00+00:00 | Order by 2pm on 17 December for UK Christmas delivery | /policies/shipping-policy
2026-12-24T12:00:00+00:00 | 2027-01-04T09:00:00+00:00 | We're closed until 4 January. Orders placed now ship on the 4th.

Always include the offset at the end of each date. +00:00 is UK winter time (GMT) and +01:00 is UK summer time (BST). In 2026 the clocks go back on 25 October, so a November or December date is +00:00. Without an offset, the date may not be read in the time zone you meant.

Rules: the first live line wins if two overlap. Lines that have ended, lines whose end is before their start, and lines without at least three parts are skipped.

The section code

{%- comment -%}
  Scheduled announcement messages ("Custom Liquid" section in the Header group).
  One message per line:  start | end | message | link (optional)
  Dates are ISO 8601 WITH an offset: +00:00 is UK winter time (GMT), +01:00 is UK summer time (BST).
{%- endcomment -%}
{%- capture schedule -%}
2026-11-27T00:00:00+00:00 | 2026-12-01T00:00:00+00:00 | Black Friday weekend: 20% off everything | /collections/all
2026-12-01T00:00:00+00:00 | 2026-12-17T14:00:00+00:00 | Order by 2pm on 17 December for UK Christmas delivery | /policies/shipping-policy
2026-12-24T12:00:00+00:00 | 2027-01-04T09:00:00+00:00 | We're closed until 4 January. Orders placed now ship on the 4th.
{%- endcapture -%}
{%- liquid
  assign now_s = 'now' | date: '%s' | plus: 0
  assign lines = schedule | strip | newline_to_br | split: '<br />'
  assign rendered = 0
-%}
{%- capture messages -%}
  {%- for line in lines -%}
    {%- assign parts = line | split: '|' -%}
    {%- if parts.size < 3 -%}{%- continue -%}{%- endif -%}
    {%- assign start_s = parts[0] | strip | date: '%s' | plus: 0 -%}
    {%- assign end_s = parts[1] | strip | date: '%s' | plus: 0 -%}
    {%- if end_s <= now_s or start_s >= end_s -%}{%- continue -%}{%- endif -%}
    {%- assign link = parts[3] | strip -%}
    <p
      class="sched-bar__msg"
      data-start="{{ start_s }}"
      data-end="{{ end_s }}"
      {% if start_s > now_s or rendered > 0 %}
        hidden
      {% endif %}
    >
      {%- if link != blank -%}
        <a href="{{ link | escape }}">{{ parts[2] | strip | escape }}</a>
      {%- else -%}
        {{ parts[2] | strip | escape }}
      {%- endif -%}
    </p>
    {%- if start_s <= now_s -%}{%- assign rendered = rendered | plus: 1 -%}{%- endif -%}
  {%- endfor -%}
{%- endcapture -%}
<div
  class="sched-bar{% if rendered == 0 %} is-idle{% endif %}"
  id="sched-{{ section.id }}"
  role="region"
  aria-label="Announcement"
>
  {{- messages -}}
</div>
<style>
  .sched-bar { text-align: center; padding: 0.9rem 1.5rem; font-size: 1.3rem; }
  .sched-bar p { margin: 0; }
  .sched-bar a { color: inherit; }
  .sched-bar.is-idle { display: none; }
</style>
<script>
  (function () {
    var bar = document.getElementById('sched-{{ section.id }}');
    if (!bar) return;
    var msgs = Array.prototype.slice.call(bar.querySelectorAll('.sched-bar__msg'));
    /* Shopify can serve a cached page, so the Liquid "now" above may be old. Re-check in the browser. */
    function update() {
      var now = Date.now() / 1000;
      var shown = false;
      msgs.forEach(function (m) {
        var live = !shown && now >= +m.dataset.start && now < +m.dataset.end;
        m.hidden = !live;
        if (live) shown = true;
      });
      bar.classList.toggle('is-idle', !shown);
    }
    update();
    setInterval(update, 30000);
  })();
</script>

Why there's JavaScript in a "scheduled" Liquid section

Liquid runs when Shopify renders the page, and Shopify caches rendered storefront pages. So the "now" in Liquid can be older than the visit. If a cached page from 23:58 is served at 00:03, Liquid would still show yesterday's message.

So the section renders every message that hasn't ended, each with its own data-start and data-end, and the browser makes the final choice. It checks on page load and every 30 seconds, so a tab left open overnight also switches. Messages that are past their end when Shopify renders the page aren't sent at all.

Without JavaScript, the Liquid decision stands. That's correct for most visits and at worst a few minutes out of date.

Install it

  1. Duplicate your theme. In Online Store → Themes, duplicate your live theme and click Customize on the copy.
  2. Add a Custom Liquid section. Under Header in the sidebar, click Add section → Custom Liquid, and drag it above or below Dawn's announcement bar.
  3. Paste and edit the schedule. Paste the code and replace the three example lines between capture schedule and endcapture with your own. Click Save.
  4. Hide the old bar if you like. If you want only scheduled messages, hide Dawn's Announcement bar section with the eye icon. Its messages stay saved.

Testing without waiting for Black Friday

  1. Add a test line that started an hour ago and ends in ten minutes. Save: it shows.
  2. Add a second line that starts when the first ends. Keep the preview open: within 30 seconds of the switch, the second one replaces the first, without a reload.
  3. Make every line end in the past: the bar disappears completely, with no empty strip.
  4. Remove one | from a line that has no link, so it has only two parts: that line is skipped and the others still work.
  5. Delete the test lines before you publish.

Other themes

This section doesn't depend on any Dawn JavaScript, so it works in any Online Store 2.0 theme that offers a Custom Liquid section in the header group. You may want to match the colours: add background and color to the .sched-bar rule, or wrap the section in your theme's colour scheme if it has one.

Need a live countdown in the bar as well?

The Announcement + countdown section shows one message with a live countdown to the end date you set in the theme editor, the same for every shopper. When time's up it hides or shows "Offer ended" (your choice). To be clear, it has an end date but no start date, so it doesn't replace this schedule. It's for the offer that's running now. £12 one-off, for one store, tested on Dawn and Horizon. Other Online Store 2.0 themes may need small style tweaks.

Buy the countdown bar, £12 Try the live demo

FAQ

Can I schedule Dawn's own announcement bar blocks instead?

Not without editing Dawn's files: its announcement blocks have no date settings. A separate section keeps your schedule in one place and survives theme updates.

Is there a limit to how many lines I can add?

No practical one. Each line that hasn't ended is sent to the browser, so remove old ones now and then to keep it tidy.

Can a message have formatting?

Messages are escaped, so HTML shows as text. That keeps a stray < from breaking your header. Use the link part for a link.

Which time zone does "now" use?

Start and end are absolute moments because they carry an offset, so the shopper's own time zone doesn't matter. Everyone switches at the same instant.

Will search engines see the scheduled messages?

The upcoming ones are in the HTML but hidden, which is normal for a header announcement. Don't put anything there you wouldn't want public yet.