***

title: "MultiChannelStockLocationStrategy"
generated: true
---------------

<GenerationInfo sourceFile="packages/core/src/config/catalog/multi-channel-stock-location-strategy.ts" sourceLine="32" packageName="@vendure/core" since="3.1.0" />

The MultiChannelStockLocationStrategy is an implementation of the [StockLocationStrategy](/current/core/reference/typescript-api/products-stock/stock-location-strategy#stocklocationstrategy).
which is suitable for both single- and multichannel setups. It takes into account the active
channel when determining stock levels, and also ensures that allocations are made only against
stock locations which are associated with the active channel.

This strategy became the default in Vendure 3.1.0. If you want to use the previous strategy which
does not take channels into account, update your VendureConfig to use to [DefaultStockLocationStrategy](/current/core/reference/typescript-api/products-stock/default-stock-location-strategy#defaultstocklocationstrategy).

```ts title="Signature"
class MultiChannelStockLocationStrategy extends BaseStockLocationStrategy {
    getAvailableStock(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => Promise<AvailableStock>;
    forAllocation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
}
```

* Extends: BaseStockLocationStrategy

<div className="members-wrapper">

### getAvailableStock

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, productVariantId: <a href='/current/core/reference/typescript-api/common/id#id'>ID</a>, stockLevels: <a href='/current/core/reference/typescript-api/entities/stock-level#stocklevel'>StockLevel</a>[]) => Promise<<a href='/current/core/reference/typescript-api/products-stock/stock-location-strategy#availablestock'>AvailableStock</a>>`}   />

Returns the available stock for the given ProductVariant, taking into account the active Channel.

### forAllocation

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, stockLocations: <a href='/current/core/reference/typescript-api/entities/stock-location#stocklocation'>StockLocation</a>[], orderLine: <a href='/current/core/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>, quantity: number) => Promise<<a href='/current/core/reference/typescript-api/products-stock/stock-location-strategy#locationwithquantity'>LocationWithQuantity</a>[]>`}   />

This method takes into account whether the stock location is applicable to the active channel.
It furthermore respects the `trackInventory` and `outOfStockThreshold` settings of the ProductVariant,
in order to allocate stock only from locations which are relevant to the active channel and which
have sufficient stock available.

</div>
