Skip to Content
FeaturesInventory

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:

FieldDescription
AvailableStock available for sale
On HandTotal physical stock (available + committed + unavailable)
CommittedStock reserved by pending orders
UnavailableStock marked as damaged, safety stock, or quality control
Is TrackedWhether 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:

  1. Add supplier details (name, contact, address).
  2. Create a purchase order with line items (product, quantity, cost).
  3. When goods arrive, receive the PO to automatically update inventory.
  4. Track PO status: Draft, Ordered, Partially Received, Received.

Key API Endpoints

Inventory Locations

GET/api/locations/:storeAuth Required

Get all inventory locations for a store

POST/api/locations/:storeAuth Required

Create a new inventory location

PUT/api/locations/:store/:idAuth Required

Update a location's details

PUT/api/locations/:store/:id/defaultAuth Required

Set a location as the default fulfillment location

Inventory Management

GET/api/inventory/product/:product_idAuth Required

Get inventory details for a product across all locations

PUT/api/inventory/product/:product_idAuth Required

Update inventory quantities for a product

PUT/api/inventory/item/:id/adjustAuth Required

Adjust inventory with a reason code (received, damaged, correction, etc.)

GET/api/inventory/movements/:product_idAuth Required

Get inventory movement history for a product

GET/api/inventory/low-stock/:storeAuth Required

Get all products below their low-stock threshold

PUT/api/inventory/track/:product_idAuth Required

Enable or disable inventory tracking for a product

Legacy Inventory APIs

POST/api/updateInventoryDetails/:storeAuth Required

Update inventory in the legacy product_inventory table

GET/api/inventory/editAuth Required

Get legacy inventory edit view for a product

POST/api/bulkStockUpdateAuth Required

Bulk update stock for multiple products (add or replace mode)

Suppliers

GET/api/suppliersAuth Required

List all suppliers for a store

POST/api/suppliersmanageAuth Required

Create or update a supplier record

Purchase Orders

POST/api/add_purchase_ordersAuth Required

Create a new purchase order with line items

GET/api/getPurchaseOrderAuth Required

Get a single purchase order by ID

GET/api/allPurchaseOrderAuth Required

List all purchase orders for a store

POST/api/supplier_purchase/duplicateAuth Required

Duplicate an existing purchase order

Database Tables

TablePurpose
product_inventoryLegacy inventory table — product_id, variant_name, available, on_hand, committed, unavailable
inventory_itemsNew multi-location inventory — product_id, variant_id, location_id, available, on_hand
inventory_locationsWarehouse/store locations with address and default flag
inventory_movementsAudit log of all stock changes with reason codes and timestamps
suppliersSupplier directory — name, contact, email, address
purchase_ordersPurchase orders — supplier, status, line items, totals, dates
  • 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