🚨 Announcing Vendure v2 Beta

DefaultStockDisplayStrategy

DefaultStockDisplayStrategy

Displays the ProductVariant.stockLevel as either 'IN_STOCK', 'OUT_OF_STOCK' or 'LOW_STOCK'. Low stock is defined as a saleable stock level less than or equal to the lowStockLevel as passed in to the constructor (defaults to 2).

Signature

class DefaultStockDisplayStrategy implements StockDisplayStrategy {
  constructor(lowStockLevel: number = 2)
  getStockLevel(ctx: RequestContext, productVariant: ProductVariant, saleableStockLevel: number) => string;
}

Implements

Members

constructor

method
type:
(lowStockLevel: number = 2) => DefaultStockDisplayStrategy

getStockLevel

method
type:
(ctx: RequestContext, productVariant: ProductVariant, saleableStockLevel: number) => string