Inventory Management

Entaprenua has built-in inventory tracking with stock levels, reserved quantities, backorder support, and low-stock alerts.


How Inventory Works

Each product tracks two quantities:

Field Description
Stock Quantity Total units available
Reserved Quantity Units held in active carts and pending orders
Available Quantity Stock Quantity − Reserved Quantity

When a customer adds a product to their cart, the reserved quantity increases. When an order is placed, the reserved quantity is converted to a sale and stock decreases. If a cart expires, reservations are released.


Stock Statuses

Status Condition
In Stock availableQuantity > outOfStockThreshold
Low Stock availableQuantity ≤ lowStockThreshold (but > outOfStockThreshold)
Out of Stock availableQuantity ≤ outOfStockThreshold
Not Tracked trackInventory = false

On the storefront, the ProductStockBadge component displays the current status automatically.


Enabling Inventory Tracking

By default, products have trackInventory set to true. To disable tracking:

  1. Open the product in the editor
  2. Set Track Inventory to off
  3. The product will always show as available

Disable tracking for digital products, services, or items with unlimited supply.


Backorders

When allowBackorder is true, customers can order products even when stock is zero. The order is created with a backorder status, and you fulfill it when stock arrives.

To enable backorders:

  1. Open the product in the editor
  2. Set Allow Backorder to on

Backorders interact with inventory tracking — if tracking is off, backorders are always allowed regardless of this setting.


Setting Thresholds

Threshold Purpose
Low Stock (lowStockThreshold) Triggers a "Low Stock" badge on the storefront. Default: 10. Set to 0 to disable.
Out of Stock (outOfStockThreshold) Product is considered out of stock when available quantity falls to this level. Default: 0.

Example: With stockQuantity = 25, lowStockThreshold = 10, outOfStockThreshold = 0:

  • 25 units → In Stock
  • 10 units → Low Stock (at or below threshold)
  • 0 units → Out of Stock

Inventory Events

Real-time inventory changes are available via the event stream at Admin → Events. This shows:

  • Stock additions and deductions
  • Reservation changes
  • Low stock alerts

For programmatic access, use the inventory SSE endpoint:

GET /api/v1/{storePublicId}/inventory/stream

This endpoint requires at least Viewer role authentication.


Bulk Inventory Updates

To update inventory for multiple products at once, use the product save endpoint with the upsert pattern — include each product's id and updated stockQuantity.

For high-volume operations, prefer batch processing with rate limiting in mind.