Expiry / batch tracking + FEFO — how does Magento handle it natively (or not)?
Categories:
Magento for Food + Grocery
Magento out-of-box does not handle FEFO (First-Expiry-First-Out) batch rotation. Inventory is treated as fungible — 100 units of SKU-A, no expiry, no batch. For food + pharma, that’s a non-starter.
What we build:
- `inventory_batch` custom table — one row per (SKU, batch_id, expiry_date, qty, warehouse_id, manufactured_date).
- FEFO allocation logic at order placement — reserve from the batch closest to expiry that has stock; decrement that batch; record `inventory_batch_id` on `sales_order_item`.
- Expiry-driven flash-sale automation — cron job nightly: any batch within 14 days of expiry → auto-discount (configurable %) → move to /clearance category → fire Klaviyo flow targeting the right cohort. Cuts spoilage write-offs 40–70% in the data we see.
- Recall workflow — admin search by `batch_id` returns every order containing that batch. One-click sends recall email + auto-issues replacement labels + refunds. Tested under drill conditions.
- Compliance reporting — FDA traceability rule (effective 2026 for most food categories) + FSSAI / EFSA recall traceability, all queryable from the same `inventory_batch` table.
Build cost: $12k–$35k depending on warehouse complexity (single 3PL vs multi-warehouse). Pays for itself the first time a recall happens cleanly instead of via spreadsheet panic.
Was this helpful?