Reorder reminders for Shopify wholesale buyers: per-buyer cycle instead of a fixed 30 days

Most “remind customers to reorder” flows use one delay for everyone. For wholesale buyers that’s wrong in both directions: a café that orders every 10 days gets reminded way too late, and a distributor on a 60-day cycle gets nagged twice before they’re due.

What I built instead (free template, n8n Cloud + self-hosted):

  • Usual cycle per buyer: the median gap between their last 10 orders (median, so one odd rush order doesn’t skew it). Due date = last order + median + grace days. Buyers with fewer than 2 orders fall back to a fixed number of days.
  • Unshipped hold-back: skips anyone who still has an unfulfilled order. Reminding someone whose last order hasn’t arrived yet is the fastest way to get unsubscribed.
  • Do-not-disturb: a true/false metafield custom.block_reorder_reminders on the customer or the B2B company, so sales reps can switch it off per account.
  • Paging: loops past 250 buyers with a cursor loop. One gotcha I hit: the HTTP Request node’s built-in pagination together with the Shopify OAuth2 credential fails with “refreshToken is required”, so I used an explicit loop (IF + collect page) instead.
  • Error outputs on the Shopify, Code, email and Sheets nodes go to one “email me the error” branch instead of failing silently.

Video walkthrough with the template link: https://youtu.be/JoPOqrKxl-4

Happy to answer questions about the GraphQL queries or the cycle logic.

Nice implementation! I especially like the per-buyer median reorder cycle and the unfulfilled-order hold-back. One edge case worth testing is duplicate reminders when the workflow retries or runs concurrently, particularly if sending the reminder succeeds but updating the buyer’s reminder status fails.

I work with n8n, Python, APIs, and PostgreSQL, focusing on idempotency, reliable processing, and explicit error handling. If you plan to extend this workflow or need help testing edge cases and improving reliability, I’d be interested in discussing a small, clearly scoped paid task.

Are the workflow JSON and code available to review?

Thanks, good point. This one is stateless on purpose: there’s no “reminded” flag to update. Each daily run works out from order history whether today is one of the buyer’s due days, so a failed status write can’t cause a repeat. The gap is a second run on the same day (manual rerun or retry after an error), which would send again. Worth a note in the guide, or a once-per-day guard for anyone who enables retries.

The free version (with the workflow JSON) is on my Gumroad if you want to look at it. I’m not looking to outsource work on it right now, but thanks for the offer.

Thanks for clarifying! That makes sense. A once-per-day guard would be a useful safeguard against manual reruns or retries. I appreciate you sharing the design details — I’ll check out the free template and learn from the implementation.

The median-gap idea is the right default. Two things broke it for me on real wholesale accounts:

  1. Split orders. Buyers often place two or three orders within a day (forgot an item, different delivery address, a rep re-keying an order). Each pair adds a gap of ~0 days and drags the median down, so the buyer gets reminded way too early. Collapsing orders placed within 48 hours into one “order event” before computing gaps fixed most of it.
  2. Order size changes. A café that switches from weekly small orders to a big order every two weeks keeps getting reminded on the old cycle until enough new gaps push the median over. If the order lines have consistent units, “days of stock” = last order quantity ÷ their average daily usage reacts much faster than the gap median.

On the stateless design: one side effect is that if n8n is down on a buyer’s exact due day, that reminder is simply never sent. Checking “due date fell within the last 2–3 days” instead of “due date is today” tolerates a missed run, and the once-per-day guard you mentioned then also stops it from sending twice inside that window.

Calculating reorder windows dynamically from historical order intervals is way more effective than arbitrary 30-day cron triggers. B2B wholesale buyers purchase on wildly different cadences depending on inventory turnover.

Storing the rolling average order frequency directly in a custom customer metafield allows n8n to query only accounts entering their expected replenishment window each week.

@JayglePromo both of those are real, and I checked the template against them.

Split orders: right now gaps come straight from order dates, so two orders on the same day add a 0-day gap. There’s a minCycleDays floor, but that only catches the case where the whole median collapses, not a median that’s just pulled early. Merging orders within 48 hours into one order event before computing gaps is the cleaner fix. I’ll add that.

Missed runs: also true. It matches “due today” exactly, so if n8n is down that day the reminder is skipped and only the second reminder catches it later. A “due date fell in the last N days” check plus a guard against sending the same reminder twice fixes it without adding state, since the last order date already tells you which reminder was sent.

Days-of-stock from quantities is a nice idea for buyers whose order size shifts. Most stores I see mix SKUs, so I’d keep the median as default and offer usage-based timing as an option where units are consistent.

@Long_Vu_Nguyen storing the cycle in a customer metafield would make the weekly “who’s entering their window” query much cheaper for big buyer lists. The template recomputes from the last 10 orders each run, which is fine up to a few thousand buyers.