This plugin helps you monitor the stock levels in two ways:
vendure-config.ts to expose a productVariantsWithLowStock query in the admin API.The "Low stock" widget is provided as a React Dashboard extension — no Admin UI compilation step is needed.
When you start the server and login, you can find Low stock under the dashboard's add widget button. The widget is only shown to administrators with the ReadCatalog permission.
StockLocationStrategy because of performance reasons. Instead, it fetches the stock level for each variant from the database and calculates its absolute stock based on the stockOnHand and stockAllocated fields.StockMovementEvent creates a job that triggers a stock check: get saleable stock, compare with variant threshold, and emit event if variant dropped below threshold. Sales (fulfillments) don't trigger a check, because they lower stockOnHand and stockAllocated by the same amount, so saleable stock doesn't change.trackInventory set to FALSE, or INHERIT while the global setting is off) never emit the event and aren't listed in the Low stock widget.StockDroppedBelowThresholdEvent being emitted a second time when an order is fulfilled. Sales lower stockOnHand and stockAllocated by the same amount, so they don't change saleable stock and no longer trigger a stock check.trackInventory set to FALSE, or INHERIT while the global setting is off) no longer emit StockDroppedBelowThresholdEvent. Vendure doesn't change their stock on allocation, so the stock check saw a drop that didn't happen.DetailPageButton.ReadCatalog permission, which its query requires.trackInventory set to INHERIT while the global setting is off, because Vendure doesn't track their stock.getVariantsBelowThreshold query failing on PostgreSQL (column "FALSE" does not exist): use a bound string parameter instead of the double-quoted "FALSE" (an identifier in Postgres), and reference the full expressions in HAVING instead of SELECT aliases (which Postgres does not allow in HAVING). The configured globalThreshold is now bound as a query parameter too. Works across PostgreSQL, MySQL and SQLite.StockDroppedBelowThresholdEvent fields from stockBeforeOrder/stockAfterOrder to stockBeforeAdjustment/stockAfterAdjustmentorder field from StockDroppedBelowThresholdEventtrackInventory query filter to use correct boolean string valueStockLevelBelowThresholdEvent.column "stockonhand" does not exist on PostgresreduceSum function call bugStockWidgetComponent standalone and removed StockWidgetSharedModule and StockWidgetModule