I run supermarket operations and kept running into the same failure, so I built it as a workflow. Sharing the logic because the pattern generalises to any perishable inventory, not just retail.
**The problem**
The same SKU arrives in multiple batches with different expiry dates. A stock system sees one line — “yogurt, 14 units” — and has no concept of *which* batch. So when staff rotate stock they discount whatever is nearest, which is usually the freshest. Result: fresh stock discounted, old stock left to expire.
**The approach**
1. Ingest batch-level stock (not product-level) with expiry dates.
2. Group by SKU, sort each SKU’s batches **oldest-first**.
3. Grade every batch: `expired` / `urgent` / `promote` / `watch`.
4. Emit an instruction naming the **exact batch** to pull *and* how much fresh stock to leave alone.
5. If nothing is in `urgent` or `expired`, **send nothing**. Alert fatigue kills these systems faster than bad logic does.
**Design notes that mattered**
- Grade on **days remaining**, never on stock quantity. Quantity tells you nothing about urgency.
- Suppress empty runs explicitly. An alert that fires daily with “all fine” gets ignored within a week.
- Keep it to standard nodes only — no community packages. Store environments update n8n infrequently and a broken node means the whole thing silently stops.
- Put the logic in one place and make the notification channel swappable. Same workflow, WhatsApp or email or Slack, based on what the team already reads.
**Trade-off worth knowing:** this is not a UI problem, it’s a data-shape problem. If the POS only exposes product-level stock, you need batch data from somewhere — a receiving log, a spreadsheet, whatever the store actually uses. The workflow is the easy part.
I also published a couple of related free ones (reorder-point calc, shelf-vs-till price audit) — no signup, direct JSON:
Happy to share the FIFO one directly if anyone wants it — just say so. Also interested if anyone has solved the same thing against a POS that only gives product-level stock; that constraint seems common.