Guides · 5-minute read

What happens on a sale: first expired, first out.

How Datima deducts each fulfilment from the batch that expires first, puts refunds back, shows unmatched sales, keeps a shipment history and lets you correct a pick.

The rule

From the moment a product has a batch, Datima watches your orders. When an order ships, the units come off the batch that expires first. If that batch runs out, the next one is used. This is first-expired-first-out — FEFO — and nobody has to touch the app for it to happen. Nothing happens when the order is placed, only when it is fulfilled; a cancelled order never touches a batch.

In a store with several locations, the batch is taken at the location that fulfilled the order, and a batch is never taken from a different location than the one that shipped (locations).

A product page in Datima: two batches, then the shipment history showing units shipped from the soonest-expiring batch and a refund returned to it.
Sales come off the soonest-expiring batch; a refund puts the units back on the batch they came from.

Refunds

A refund puts the units back on the exact batch they came from — not on whichever batch is oldest now. The record is append-only: the shipment stays, and a return line points at it, so the history of every unit is a query, not a guess.

Unmatched sales

When more units ship than your batches cover — sales from before you recorded the batch, or a delivery you have not entered — Datima does not invent a batch. It shows the gap: ⚠ 6 sold units unmatched to any batch on the dashboard, ⚠ unmatched sales on the product's row, and on the product's page: These sales happened before their batches were recorded. Add the missing batch, then use “Correct” on the unmatched shipment below.

So the dashboard is honest by construction. A product with unmatched sales is a prompt to record stock, never a silently wrong number.

The shipment history

The product's page lists every movement under its batches: → shipped 2 from A3155 · order 1042, ↩ returned 1 from A3155, or no batch (unmatched) when nothing covered it. Show all opens the full list.

Correct a shipment

Sometimes the picker took a different batch than the earliest one — from overflow, not the pick face — or a shipment was unmatched because the batch was entered late. Press Correct on the shipment. The dialog explains what happened (2 units were attributed by earliest-expiry guess, or attributed to no batch at all) and lists only the batches that could plausibly have been picked: received on or before the sale, with stock remaining. Choose the actual batch, add a reason if you like, and press Correct. Both records are kept: the guess and the correction.

When your batches and Shopify differ

Each product's page shows both counts — Tracked 42 · Shopify 44 — and, when they differ, Differs from Shopify. What? opens the two reasons they can differ:

  • Stock not entered as a batch yet. Shopify counts units that no batch covers yet, for example a delivery without a batch. Add a batch for it, or set the batch quantities to what is on the shelf.
  • Shopify's quantity not kept. If your shop does not keep stock quantities in Shopify (overselling allowed, stock counted elsewhere), the two numbers cannot agree. Turn the comparison off under Settings › Compare batches with Shopify stock.

Only products with a batch in stock are compared. A batch saved without a location is compared with the product's stock across all your locations; batches with a location are compared location by location, and the page lists each location that differs. The dashboard counts the same products as N items where batches and Shopify stock differ; click it to list them. ✓ In sync means your batches match Shopify's stock: in total when a batch has no location, at every location when they all have one — so five units in a batch at the store room against five in Shopify at the shop still differ, and the page names both locations.

What the rest of your store sees

Each variant carries its earliest expiry date as a metafield, expiry.earliest_expiry, kept current as batches are added, sold and zeroed. Your theme shows it through the Best before block; Shopify Flow or another app can read it too.

Questions? support@datima.ai · Last updated 14 October 2026