Inventory Management

Track stock levels, link products to inventory items, and manage availability

Inventory Management

The inventory system tracks stock across every Hayya vertical — eats, hotels, care, and tools. It is shared at the API level (/api/inventory/) and tenant-scoped by store_id, so each store manages its own items independently.

Overview

Inventory items are general-purpose records with a type, quantity, unit, and pricing. In the eats vertical they back menu products; in hotels they back amenities and room-service items. Items are categorized using inventory_categories, and each item type is restricted to product, amenity, or service.

ColumnPurpose
name_ar / name_enBilingual item name
item_typeproduct, amenity, or service
quantityCurrent stock on hand
unitUnit of measure (e.g. kg, liter, piece)
low_stock_thresholdLow-stock alert trigger
show_on_menuAlways show on storefront even when unavailable
is_availablePer-item availability flag

Stock Tracking

Each inventory item carries a numeric quantity and a low_stock_threshold. When quantity drops below the threshold, the item is flagged as low stock and surfaces in the admin. At zero, the item is out of stock.

Stock is never modified silently — every change is recorded as an inventory transaction (see below), giving you a full audit trail of who changed what and why.

Product Linking (Eats)

In the eats vertical, menu items and inventory items are separate records. Linking connects them so that placing an order for a menu product automatically deducts from the linked inventory item.

ActionEndpoint
Link a productPOST /api/inventory/link-product
Unlink a productPOST /api/inventory/unlink-product/:productId
List linked products with stockGET /api/inventory/products-with-stock

Once linked, the storefront menu shows the product's stock badge (low, in stock, out of stock) using the inventory item's quantity. Unlinking leaves the menu product in place but stops tracking stock for it.

The show_on_menu Flag

Inventory items with show_on_menu = true always appear on the storefront menu, even when is_available = false.

show_on_menuis_availableStorefront Behavior
truetrueShown normally with stock badges
truefalseShown with "Currently Unavailable" badge; add-to-cart disabled
falseanyNot shown on storefront

This lets you keep an item visible (so customers know it exists) while temporarily disabling purchase — useful during supply shortages or prep pauses.

The is_available Flag

When is_available is set to false, the storefront shows a "Currently Unavailable" badge on the item and disables the add-to-cart button. This takes priority over the stock badge regardless of the stock_display setting.

The gateway query (handleGetMenu) intentionally omits the is_available = true filter so that unavailable-but-shown items still reach the storefront.

Stock Display Setting

Each store has a stock_display column that controls how stock information renders on the customer storefront. Set it in Admin → Settings.

ValueBadgeDescription
count (default)"Only 3 left" / "Out of Stock"Shows exact count for low stock, "Out of Stock" for zero
status"In Stock" / "Out of Stock"Binary status only, no count
hiddenNo badgeStock badges hidden entirely

"Out of Stock" always shows unless stock_display = 'hidden' — even at status, a zero-quantity item labels itself out of stock.

Inventory Transactions

Every stock change is logged in inventory_transactions with a reason:

ReasonWhen used
restockNew shipment received, quantity added
adjustmentCorrection after physical count
damageSpoilage, breakage, write-off

Each row records the item, the delta, the reason, the staff member, and the timestamp. This gives you a defensible audit trail for shrinkage reports and end-of-month reconciliation.

Admin Workflow

Create an Inventory Item

  1. Go to Admin → Inventory (eats: verticals/eats/views/Inventory.vue; hotels: verticals/hotels/views/Inventory.vue)
  2. Click Create Item
  3. Fill in name (Arabic + English), type, unit, quantity, low-stock threshold, and price
  4. Save — the item appears in the table immediately

Adjust Stock

  1. Find the item in the inventory table
  2. Click the Adjust action
  3. Choose a reason (restock / adjustment / damage) and enter the new quantity or delta
  4. Save — a transaction row is written and the item's quantity updates

Enable / Disable Product Tracking (Eats)

On the eats inventory page each product row shows link/unlink and enable/disable controls:

  • 🔗 Link — connect the menu product to an existing inventory item
  • 🔓 Disable tracking — keep the product on the menu but stop deducting inventory
  • ✏️ Edit — open the item modal to change name, threshold, or price

Hotels Inventory

Hotels inventory uses type tabs (amenity / product / service) instead of the product-linking grid. The combined create/edit modal includes a show_on_menu toggle column so you can control which items appear on the room-service menu.

Troubleshooting

An item shows in stock on admin but "Out of Stock" on the storefront. Check the stock_display setting and whether the product is linked. Unlinked products don't read inventory at all.

Stock didn't drop after an order. Confirm the menu product is linked to the inventory item. Linking is per-product — a missing link means no deduction.

An item isn't appearing on the storefront. Verify show_on_menu = true. Items with show_on_menu = false are hidden from the storefront regardless of availability.