All guides › Dispatch time: in stock vs backorder

Show a different dispatch time for in-stock and backorder items in Shopify

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.

Selling past zero stock (backorders, pre-orders, made-to-order) is one tick box in Shopify: Continue selling when out of stock. The catch is that the product page looks identical either way. A shopper buying the last in-stock size and one buying a backordered size both see the same "Add to cart" and expect the same dispatch time. This block tells them which one they're getting, for the exact variant they've selected.

How Shopify tells the two apart

For each variant, three things decide what the shopper is buying:

  • variant.inventory_management: blank if you don't track stock for that variant.
  • variant.inventory_quantity: what's in stock now. It can go below 0 when you sell past zero.
  • variant.inventory_policy: continue when "Continue selling when out of stock" is ticked, deny when it isn't.
Tracked?QuantityPolicyThe block shows
Non/an/aNormal dispatch time
Yes1 or moreeitherNormal dispatch time
Yes0 or lesscontinueBackorder dispatch time
Yes0 or lessdenyNothing: it's sold out, and Dawn says so on the button

The block code

The two default sentences are at the top. Products that need different wording can override them with metafields (below).

{%- comment -%}
  Dispatch time that changes with stock (Dawn "Custom Liquid" block in Product information).
  Optional product metafields (single line text): custom.dispatch_in_stock and custom.dispatch_backorder.
  Products without them use the defaults below.
{%- endcomment -%}
{%- liquid
  assign default_in_stock = 'Dispatched within 1 to 2 working days'
  assign default_backorder = 'Made to order: dispatched within 2 to 3 weeks'
  assign v = product.selected_or_first_available_variant
  assign message = ''
  if v.available
    assign message = product.metafields.custom.dispatch_in_stock.value | default: default_in_stock
    if v.inventory_management != blank and v.inventory_quantity <= 0 and v.inventory_policy == 'continue'
      assign message = product.metafields.custom.dispatch_backorder.value | default: default_backorder
    endif
  endif
-%}
<p class="dispatch-time" id="DispatchTime-{{ section.id }}" data-section="{{ section.id }}">
  {{- message | escape -}}
</p>
<style>
  .dispatch-time { margin: 0 0 1.5rem; font-size: 1.4rem; }
  .dispatch-time:empty { display: none; }
</style>
<script>
  (function () {
    var el = document.getElementById('DispatchTime-{{ section.id }}');
    if (!el) return;
    function init() {
      if (typeof subscribe !== 'function' || typeof PUB_SUB_EVENTS === 'undefined') return;
      /* Dawn fetches the whole product section for the new variant and passes it in event.data.html. */
      /* Copy our own paragraph out of it, so the Liquid above is the single source of truth. */
      subscribe(PUB_SUB_EVENTS.variantChange, function (event) {
        if (!event.data || event.data.sectionId !== el.dataset.section || !event.data.html) return;
        var fresh = event.data.html.getElementById(el.id);
        if (fresh) el.textContent = fresh.textContent;
      });
    }
    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
    else init();
  })();
</script>

Why it copies HTML instead of recalculating in JavaScript

When a shopper changes size or colour, Dawn fetches the product section again, rendered by Shopify for the new variant, and publishes it with PUB_SUB_EVENTS.variantChange as event.data.html. That response already contains this block, rendered by the same Liquid for the new variant. So the script just copies the new paragraph's text across.

The alternative, recalculating in JavaScript, would mean duplicating the rules and exposing stock numbers in the page. Copying keeps the Liquid as the only place the logic lives, and works with your metafields automatically.

Optional: different wording per product

Create two product metafield definitions in Settings → Custom data → Products, both Single line text:

  • custom.dispatch_in_stock, e.g. "Dispatched next working day"
  • custom.dispatch_backorder, e.g. "Pre-order: ships from 12 January"

Fill them on products that differ from your defaults. Empty fields fall back to the defaults in the code.

Install it

  1. Duplicate your theme and open Customize. In Online Store → Themes, duplicate your theme and click Customize on the copy.
  2. Add a Custom Liquid block. Open Products → Default product. In Product information, click Add block → Custom Liquid and drag it near the buy buttons.
  3. Paste and set your wording. Paste the code and edit default_in_stock and default_backorder. Click Save.

Notes for other themes

The Liquid works in any Online Store 2.0 theme with a Custom Liquid block, and is correct for the variant selected when the page loads (including links with ?variant=). The live switch relies on Dawn's variantChange event carrying the re-rendered section. Dawn 16 does this. In themes that don't, the text keeps the first variant's message, so in that case keep the sentence general ("Most sizes ship in 1 to 2 days; others are made to order").

Dawn also has an Inventory status block ("In stock", "Low stock: 3 left"). That's about quantity. This block is about when it leaves. They work well together.

Testing checklist

  1. Pick a product with one variant in stock and one at 0 with "Continue selling" ticked.
  2. Load the in-stock variant: normal dispatch time.
  3. Switch to the 0-stock variant: the backorder sentence appears without a reload.
  4. Untick "Continue selling" for that variant: switching to it shows no dispatch text and Dawn shows Sold out.
  5. Add a custom.dispatch_backorder value to the product: the new wording appears for the backordered variant.

Want an actual delivery date under the button?

The Estimated delivery section turns your dispatch rules into a date range (by default: "Order within 3h 12m for dispatch today. Estimated delivery Thu 3 Dec – Mon 7 Dec"). You set the cutoff time, time zone, dispatch days, handling and transit days, Saturday delivery, closed dates and an optional Christmas line, all in the theme editor. It uses one handling time for the store, so it doesn't switch for backorders like the block above. £12 one-off, for one store, tested on Dawn and Horizon. Other Online Store 2.0 themes may need small style tweaks.

Buy the Estimated delivery section, £12 Try the live demo

FAQ

Does Shopify have a built-in backorder or pre-order message?

Not in Online Store themes. "Continue selling when out of stock" only lets the order through. Saying what that means for dispatch is up to the theme.

Will this show stock numbers to shoppers?

No. The Liquid reads the quantity, but only the sentence is sent to the page.

What about variants that aren't tracked?

They always show the normal dispatch time, because Shopify has no stock level to compare.

Can I show the backorder text on the cart page too?

Each cart line has item.variant with the same fields, so the same condition works in the cart. That needs editing Dawn's cart files and isn't covered here.

Can I use it for pre-orders with a date?

Yes. Put the date in the product's custom.dispatch_backorder text, e.g. "Pre-order: ships from 12 January", and remember to update it if the date moves.