Hyperse
  • Pricing
  • FAQs
Newsletter

Subscribe to our newsletter

Receive weekly updates with latest collections and exclusive offers, straight to your inbox.

Hyperse

Headless commerce solutions for brands, developers, and modern ecommerce teams.

Explore

  • Home
  • About Us
  • Partners
  • FAQs

Legal & resources

  • Proposal
  • Privacy Policy
  • Terms & Conditions

© 2026 Hyperse. All rights reserved.


  1. Home
  2. Vendure Plugins
  3. hps-plugin-stock-monitor
hps-plugin-stock-monitor

hps-plugin-stock-monitor

By Yingchun Tian

hps-plugin-stock-monitor is a Stock Monitor plugin in the Hub Store group.hps-plugin-stock-monitor provides Stock Monitor plugin capabilities for Hub Store. Storefront commerce features for shopping and orders. It is especially useful for store workflows.

CoreVendure Plugins

Specifications

Technical details and package information for this product.

Package

@hyperse-hub/hps-plugin-stock-monitor

Support by

Yingchun Tian

Support languages

TypeScript, JavaScript, CSS, Prolog, Shell

Integration type

Core

Category

Vendure Plugins

Compatible with

^3.0.0

Latest version

1.1.6

Downloads

0

Repository

https://github.com/hyperse-hub/hub-store

Last published

July 14, 2026

Description
Changelog
loading...

@hyperse-hub/hps-plugin-stock-monitor

Vendure plugin for low-stock monitoring, Admin API listing, and email alerts when inventory crosses your threshold (on order placement and optional daily digest). Part of the Hub Store group — see Platform.md.

Features

  • Admin GraphQL — Paginated query productVariantsWithLowStock lists variants whose summed on-hand stock for the current channel is below a configurable threshold (same rules as alerts).
  • Order-based alerts — After an order is placed, the plugin detects variants whose available stock crossed from at/above the threshold to at/below it because of that order, then raises a low-stock alert for those lines only (avoids noise when stock was already low).
  • Scheduled digest — Optional daily task (09:00 server time) runs per channel and publishes a single alert per channel when any variants are below threshold (full channel scan, not threshold-cross detection).
  • Email integration — Registers a low-stock template with @hyperse-hub/hps-plugin-email (React Email), with product links built from adminProductUrl.
  • Filtering options — Optionally exclude disabled or soft-deleted products, and optionally skip “fully out of stock” variants so only partial low stock is reported.

Prerequisites

  • Vendure >=3.3.0 (as declared by the plugin compatibility).
  • @hyperse-hub/hps-plugin-email must be loaded and configured so transactional email and templates work. Register it in your VendureConfig.plugins (typically before this plugin) with valid SMTP or provider settings.

Installation

Configuration

OptionTypeDefaultDescription
thresholdnumber10Stock level below which a variant is considered low (per channel, summed stock locations linked to the channel).
subjectstring'Stock of variants below {threshold}'Email subject line. You can keep the literal {threshold} for your template or replace it; template vars also expose threshold for the body.
adminProductUrlstring'/admin/catalog/products/'Base path used in the email template to link to products in the Admin UI (combined with product id as your template expects).
emailRecipients

Admin GraphQL

Requires ReadCatalog permission.

  • threshold — Optional; defaults to the plugin threshold option.
  • options — Standard Vendure list options (pagination, sort, filter) applied to the variant query.

Stock is evaluated using summed stockOnHand for stock locations assigned to the current channel, consistent with the scheduled check and email line collection.

Events

The plugin publishes LowStockAlertEvent (exported from the package) when:

sourceWhen
'order'At least one order line caused stock to cross into the low band (from at/above threshold to at/below).
'scheduled'The daily job found one or more low-stock variants in that channel.

Payload includes ctx, lines (LowStockLine: name, ids, stockOnHand), optional order when source === 'order'.

Email template

On bootstrap, the plugin registers the low-stock handler with the email plugin. Template variables typically include:

  • lines — Rows for the email body.
  • adminProductUrl — For building Admin links.
  • threshold — Configured threshold.

Ensure the email package can resolve the bundled template path (templates/dist in the published package).

Scheduler

Task id: daily-low-stock-check. Runs every day at 09:00 (server timezone). Iterates all channels, builds a request context per channel, collects low-stock lines, and publishes LowStockAlertEvent with source: 'scheduled' when the list is non-empty. Disable with enableDailyStockCheck: false.

Development

From this package directory:

License

MIT — see repository root.

On this page

  • @hyperse-hub/hps-plugin-stock-monitor
    • Features
    • Prerequisites
    • Installation
    • Configuration
    • Admin GraphQL
    • Events
    • Email template
    • Scheduler
    • Development
    • License

import { HpsPluginEmail } from '@hyperse-hub/hps-plugin-email';
import { HpsPluginStockMonitor } from '@hyperse-hub/hps-plugin-stock-monitor';
const config: VendureConfig = {
plugins: [
HpsPluginEmail.init({/* email plugin options */}),
HpsPluginStockMonitor.init({
threshold: 10,
subject: 'Stock of variants below {threshold}',
adminProductUrl: '/admin/catalog/products/',
emailRecipients: ['ops@example.com'],
}),
],
};
string[] | (injector, event) => string[] | Promise<string[]>
[]
Static list or async resolver. For dynamic routing, the function receives the injector and LowStockAlertEvent (includes order when the source is order).
enableDailyStockCheckbooleantrueWhen false, the daily scheduled task does not run.
excludeDelistedProductsbooleantrueWhen true, variants whose parent product is disabled or soft-deleted are omitted from queries and alerts.
skipAlertsForZeroStockbooleantrueWhen true, variants with no remaining stock are not treated as low-stock (useful if out-of-stock is acceptable short-term). When false, zero stock still triggers like older behavior.
query LowStockVariants($threshold: Int, $options: ProductVariantListOptions) {
productVariantsWithLowStock(threshold: $threshold, options: $options) {
totalItems
items {
id
name
sku
# ... other ProductVariant fields allowed by your schema
}
}
}
# run a local test server (see ./config/dev-server.ts)
yarn serve
# email template preview (React Email)
yarn email-dev
# build / lint / typecheck / tests
yarn build
yarn lint
yarn typecheck
yarn test