Skip to main content

DefaultStockLocationStrategy

DefaultStockLocationStrategy

The DefaultStockLocationStrategy was the default implementation of the StockLocationStrategy prior to the introduction of the MultiChannelStockLocationStrategy. It assumes only a single StockLocation and that all stock is allocated from that location. When more than one StockLocation or Channel is used, it will not behave as expected.

Signature
class DefaultStockLocationStrategy extends BaseStockLocationStrategy {
init(injector: Injector) => ;
getAvailableStock(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => AvailableStock;
forAllocation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => LocationWithQuantity[] | Promise<LocationWithQuantity[]>;
}
  • Extends: BaseStockLocationStrategy

init

method
(injector: Injector) =>

getAvailableStock

method
(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => AvailableStock

forAllocation

method
(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => LocationWithQuantity[] | Promise<LocationWithQuantity[]>