Skip to content

Feat/low stock alerts - #16

Merged
mttshw merged 2 commits into
masterfrom
feat/low-stock-alerts
Aug 1, 2026
Merged

Feat/low stock alerts#16
mttshw merged 2 commits into
masterfrom
feat/low-stock-alerts

Conversation

@mttshw

@mttshw mttshw commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Changes

Testing

Checklist

  • npm run typecheck passes
  • npm test passes
  • CHANGELOG.md updated under Unreleased (if user-facing)
  • No secrets, .env* files, or generated artifacts committed

mttshw added 2 commits August 1, 2026 16:52
Adds GET /admin/orders/export.csv (an 'Export CSV' button on the orders
list) that streams all orders as CSV — order number, date, status,
fulfillment, customer, money fields as decimals, discount, tax, shipping
method, tracking, flattened shipping address and notes. Proper quote
escaping and a UTF-8 BOM so Excel renders currency/accents. Route is
registered before /orders/:id so it isn't parsed as an id.
Emails the store owner when a product variant drops to/below a threshold
after a paid order. Only alerts on the order that *crosses* the threshold
(not every subsequent order for an already-low item), physical variants
only, and only on a fresh paid transition (never on duplicate webhooks).

- migration 029 seeds an editable 'low_stock' email template + a default
  threshold of 5
- Settings → Store: low-stock threshold (blank = off, 0 = only sold out)
- findOrderStockLevels query + pure crossedLowStock() helper (unit-tested)
- notifyLowStock() wired after markOrderPaid at all three payment sites
@mttshw
mttshw merged commit 1a02459 into master Aug 1, 2026
1 check passed
@mttshw
mttshw deleted the feat/low-stock-alerts branch August 1, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant