Docs/Technical Concepts

How Stock Consistency Is Guaranteed

Fulfiro treats stock accuracy as non-negotiable. Here is how the system ensures your numbers stay correct even when things go wrong.

InventoryLevel as source of truth

The InventoryLevel record (one per product per location) is the authoritative source for on-hand stock. Every stock change flows through a single code path that updates the InventoryLevel, creates a StockMovement, and recalculates cached totals.

Reservation integrity

Reservations use database-level constraints to prevent double-booking. A reservation references a specific InventoryLevel and order line item. The reserved quantity is always calculated from active reservations, never stored as a denormalized counter.

Discrepancy detection (not silent overwrite)

When WooCommerce reports a different stock quantity, Fulfiro does not blindly accept it. It creates a discrepancy alert for human review. This prevents external changes (other plugins, manual WooCommerce admin edits) from corrupting your carefully maintained inventory.

Audit trail

Every stock change produces a StockMovement record with the movement type, quantity delta, reason, reference, and user. If numbers ever look wrong, the movement history tells you exactly what happened and when.

Atomic operations

Stock adjustments, reservation creation, and PO receiving all run within database transactions. If any step fails, the entire operation rolls back. You never end up with a partial state (e.g., stock decremented but no movement recorded).

Related: Stock Levels Explained | Idempotency | Data Model