DW Alliance
Online store

Restock notifications

When an item sells out, your customers can ask to be told when it is back. You get the sale as soon as you restock, and a clear picture of what people are waiting for.

Sales the moment you restock

A sold-out page does not have to be a dead end. The customer enters an email, confirms it from a link, and goes on with their day. When you receive stock, they get one email with a link straight back to that product. People who already wanted the item are often ready to buy it as soon as it returns, so a restock can turn into sales the same day, without a new advertising campaign.

DW Alliance builds, maintains and extends the technology that lets clients’ AIs build their dream websites. Millions of our clients’ customers have been served through our systems. We support 72,000+ clients through partnerships that sell our technology on different platforms. Restock alerts are part of the store that already lives on your own domain.

Demand you can plan with

Every signup is a signal. If one preparation has a long waiting list and another has none, you can see what to make, order, or bring back first. Restock demand is not a guess from a general survey: it is people who stood on a product page, asked to be notified, and confirmed their email. That list tells you what to restock, and in what order, before you spend on inventory you may not need.

How it works for your customer

  1. They ask to be told. On a sold-out product they enter their email. A message asks them to leave the page open, check their inbox, and click the confirmation link.
  2. They confirm once. After they click, they are on the list. They can close the page. We will not mail them until the item is actually back.
  3. You restock. When the item goes from out of stock to in stock, they get one email for that product, with a single link to buy it.
  4. They stay in control. Every email has an unsubscribe link, including the one-click unsubscribe their mail app may offer. If they buy the item, we stop mailing them about it.

How it works for you

Good to know

See how the store works   Get started   Ask us a question

Example code

Use these snippets on a sold-out product page, or start from the copyable store.js in the store kit, which already includes this behavior. A plain-text copy lives at store-kit/RESTOCK.txt.

Storefront signup form

The hidden website field is a honeypot; leave it empty. Post to /store/restock/ on the store’s own domain. The response is JSON {ok:true, handle:"…"}. A honeypot submission also returns a handle, but that handle never validates.

<form class="dw-restock" data-restock-form data-variant-id="VARIANT_ID">
  <label>Email <input type="email" name="email" required autocomplete="email"></label>
  <input type="text" name="website" value="" tabindex="-1" autocomplete="off" aria-hidden="true" class="dw-restock-hp">
  <button type="submit">Tell me when it's back</button>
</form>

<script>
document.querySelector("[data-restock-form]").addEventListener("submit", function (ev) {
  ev.preventDefault();
  var form = ev.currentTarget;
  var body = {
    action: "signup",
    email: (form.querySelector("input[name=email]") || {}).value || "",
    variant_id: form.getAttribute("data-variant-id"),
    website: (form.querySelector("input[name=website]") || {}).value || ""
  };
  fetch("/store/restock/", {
    method: "POST",
    headers: {"Content-Type": "application/json", "Accept": "application/json"},
    credentials: "same-origin",
    body: JSON.stringify(body)
  }).then(function (r) { return r.json(); })
    .then(function (j) { if (j && j.ok && j.handle) restockPopup(j.handle); });
});
</script>

Confirmation popup

After signup, ask the visitor not to close the page, check their inbox, and click the confirmation link. Poll the unguessable handle every few seconds. GET /store/restock/?h=HANDLE returns {ok:true, validated:false} until they confirm, then {ok:true, validated:true}. Unknown handles look the same as not-yet-confirmed ones, so the poll cannot be used to see whether someone else is already on the list.

function restockPopup(handle) {
  var pop = document.createElement("div");
  pop.setAttribute("role", "dialog");
  pop.setAttribute("aria-modal", "true");
  pop.innerHTML = "<div><h2>Check your email</h2><p>Don't close this. Check your email and click the link, and this popup will close.</p></div>";
  document.body.appendChild(pop);
  var stopped = false, ticks = 0;
  function tick() {
    if (stopped || ++ticks > 200) return; // ~10 minutes at 3s
    fetch("/store/restock/?h=" + encodeURIComponent(handle), {credentials: "same-origin", cache: "no-store"})
      .then(function (r) { return r.json(); })
      .then(function (j) {
        if (j && j.ok && j.validated) {
          stopped = true;
          pop.innerHTML = "<div><h2>You are signed up</h2><p>We will email you when this item is back in stock.</p></div>";
          setTimeout(function () { if (pop.parentNode) pop.parentNode.removeChild(pop); }, 1800);
        } else {
          setTimeout(tick, 3000);
        }
      })
      .catch(function () { setTimeout(tick, 3000); });
  }
  setTimeout(tick, 1500);
}

Per-variant email fields

Staff set a store-wide default, then optionally override it on a single variant. Empty variant fields fall back to the store default, then to the built-in text. Placeholders: {{product_name}}, {{product_url}}, {{variant_name}}, {{store_name}}, {{unsubscribe_url}}. Use the same session already used for the store.

POST /store/restock/
{"session":"YOUR_SESSION","brand":"YOUR_BRAND","action":"settings_update",
 "restock_subject":"{{product_name}} is back",
 "restock_from":"Your Store <support@dwalliance.com>",
 "restock_body":"Good news — {{product_name}} is back in stock.\n\n{{product_url}}\n\nIf you no longer want these emails: {{unsubscribe_url}}"}

POST /store/restock/
{"session":"YOUR_SESSION","brand":"YOUR_BRAND","action":"variant_email_update",
 "variant_id":"VARIANT_ID","restock_subject":"","restock_from":"","restock_body":""}

Staff can also settings_read, variant_email_read, and list or history of subscribers. The in-app store guide has the full directions.

For the technical folks

Restock notifications are a module at app.dwalliance.com/store/restock/. Visitors sign up on the store domain; staff set brand and variant email copy, and can list subscribers and history, with the same session they already use for the store. The in-app store guide has the full directions. See also Developers.