Inventory
Overview
The Inventory feature provides multi-location stock management for Siyahfy stores. Vendors can track stock levels across multiple warehouse locations, receive low-stock alerts, adjust inventory quantities with reason codes, view movement history, and manage suppliers and purchase orders. The system supports both a legacy single-location inventory model and a newer multi-location system with full audit trails.
How It Works
Inventory Tracking
Each product (or product variant) has an inventory record that tracks:
| Field | Description |
|---|---|
| Available | Stock available for sale |
| On Hand | Total physical stock (available + committed + unavailable) |
| Committed | Stock reserved by pending orders |
| Unavailable | Stock marked as damaged, safety stock, or quality control |
| Is Tracked | Whether inventory is tracked (untracked = infinite stock) |
Multi-Location Support
Vendors can define multiple stock locations (warehouses, retail stores, fulfillment centers). Inventory is tracked independently per location, allowing:
- Different stock levels at each location
- Location-based fulfillment routing
- Transfer between locations
- Per-location low-stock alerts
Inventory Adjustments
Manual inventory adjustments record a reason for the change:
- Received — New stock received from supplier
- Damaged — Stock marked as damaged
- Correction — Count correction after physical audit
- Return — Customer return restocked
- Transfer — Stock moved between locations
All adjustments are logged in the inventory_movements table for audit purposes.
Suppliers & Purchase Orders
Vendors can manage their suppliers and create purchase orders to replenish stock:
- Add supplier details (name, contact, address).
- Create a purchase order with line items (product, quantity, cost).
- When goods arrive, receive the PO to automatically update inventory.
- Track PO status: Draft, Ordered, Partially Received, Received.
Key API Endpoints
Inventory Locations
Inventory Management
Legacy Inventory APIs
Suppliers
Purchase Orders
Database Tables
| Table | Purpose |
|---|---|
product_inventory | Legacy inventory table — product_id, variant_name, available, on_hand, committed, unavailable |
inventory_items | New multi-location inventory — product_id, variant_id, location_id, available, on_hand |
inventory_locations | Warehouse/store locations with address and default flag |
inventory_movements | Audit log of all stock changes with reason codes and timestamps |
suppliers | Supplier directory — name, contact, email, address |
purchase_orders | Purchase orders — supplier, status, line items, totals, dates |
Related Features
- Products — Every product has an inventory record
- Orders — Order fulfillment decrements inventory; cancellations restock
- Bulk Operations — Bulk stock updates across many products
- Analytics — Inventory levels inform product analytics