***

title: "StockMovementService"
generated: true
---------------

<GenerationInfo sourceFile="packages/core/src/service/services/stock-movement.service.ts" sourceLine="41" packageName="@vendure/core" />

Contains methods relating to [StockMovement](/current/core/reference/typescript-api/entities/stock-movement#stockmovement) entities.

```ts title="Signature"
class StockMovementService {
    shippingEligibilityCheckers: ShippingEligibilityChecker[];
    shippingCalculators: ShippingCalculator[];
    constructor(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, globalSettingsService: GlobalSettingsService, stockLevelService: StockLevelService, eventBus: EventBus, stockLocationService: StockLocationService)
    getStockMovementsByProductVariantId(ctx: RequestContext, productVariantId: ID, options?: StockMovementListOptions) => Promise<PaginatedList<StockMovement>>;
    adjustProductVariantStock(ctx: RequestContext, productVariantId: ID, stockOnHandNumberOrInput: number | StockLevelInput[]) => Promise<StockAdjustment[]>;
    createAllocationsForOrder(ctx: RequestContext, order: Order) => Promise<Allocation[]>;
    createAllocationsForOrderLines(ctx: RequestContext, lines: OrderLineInput[]) => Promise<Allocation[]>;
    createSalesForOrder(ctx: RequestContext, lines: OrderLineInput[]) => Promise<Sale[]>;
    createCancellationsForOrderLines(ctx: RequestContext, lineInputs: OrderLineInput[]) => Promise<Cancellation[]>;
    createReleasesForOrderLines(ctx: RequestContext, lineInputs: OrderLineInput[]) => Promise<Release[]>;
}
```

<div className="members-wrapper">

### shippingEligibilityCheckers

\<MemberInfo kind="property" type={`<a href='/current/core/reference/typescript-api/shipping/shipping-eligibility-checker#shippingeligibilitychecker'>ShippingEligibilityChecker</a>[]`}   />

### shippingCalculators

\<MemberInfo kind="property" type={`<a href='/current/core/reference/typescript-api/shipping/shipping-calculator#shippingcalculator'>ShippingCalculator</a>[]`}   />

### getStockMovementsByProductVariantId

\<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>, options?: StockMovementListOptions) => Promise<<a href='/current/core/reference/typescript-api/common/paginated-list#paginatedlist'>PaginatedList</a><<a href='/current/core/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a>>>`}   />

Returns a [PaginatedList](/current/core/reference/typescript-api/common/paginated-list#paginatedlist) of all StockMovements associated with the specified ProductVariant.

### adjustProductVariantStock

\<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>, stockOnHandNumberOrInput: number | StockLevelInput[]) => Promise<<a href='/current/core/reference/typescript-api/entities/stock-movement#stockadjustment'>StockAdjustment</a>[]>`}   />

Adjusts the stock level of the ProductVariant, creating a new [StockAdjustment](/current/core/reference/typescript-api/entities/stock-movement#stockadjustment) entity
in the process.

### createAllocationsForOrder

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, order: <a href='/current/core/reference/typescript-api/entities/order#order'>Order</a>) => Promise<<a href='/current/core/reference/typescript-api/entities/stock-movement#allocation'>Allocation</a>[]>`}   />

Creates a new [Allocation](/current/core/reference/typescript-api/entities/stock-movement#allocation) for each OrderLine in the Order. For ProductVariants
which are configured to track stock levels, the `ProductVariant.stockAllocated` value is
increased, indicating that this quantity of stock is allocated and cannot be sold.

### createAllocationsForOrderLines

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, lines: OrderLineInput[]) => Promise<<a href='/current/core/reference/typescript-api/entities/stock-movement#allocation'>Allocation</a>[]>`}   />

Creates a new [Allocation](/current/core/reference/typescript-api/entities/stock-movement#allocation) for each of the given OrderLines. For ProductVariants
which are configured to track stock levels, the `ProductVariant.stockAllocated` value is
increased, indicating that this quantity of stock is allocated and cannot be sold.

### createSalesForOrder

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, lines: OrderLineInput[]) => Promise<<a href='/current/core/reference/typescript-api/entities/stock-movement#sale'>Sale</a>[]>`}   />

Creates [Sale](/current/core/reference/typescript-api/entities/stock-movement#sale)s for each OrderLine in the Order. For ProductVariants
which are configured to track stock levels, the `ProductVariant.stockAllocated` value is
reduced and the `stockOnHand` value is also reduced by the OrderLine quantity, indicating
that the stock is no longer allocated, but is actually sold and no longer available.

### createCancellationsForOrderLines

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, lineInputs: OrderLineInput[]) => Promise<<a href='/current/core/reference/typescript-api/entities/stock-movement#cancellation'>Cancellation</a>[]>`}   />

Creates a [Cancellation](/current/core/reference/typescript-api/entities/stock-movement#cancellation) for each of the specified OrderItems. For ProductVariants
which are configured to track stock levels, the `ProductVariant.stockOnHand` value is
increased for each Cancellation, allowing that stock to be sold again.

### createReleasesForOrderLines

\<MemberInfo kind="method" type={`(ctx: <a href='/current/core/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, lineInputs: OrderLineInput[]) => Promise<<a href='/current/core/reference/typescript-api/entities/stock-movement#release'>Release</a>[]>`}   />

Creates a [Release](/current/core/reference/typescript-api/entities/stock-movement#release) for each of the specified OrderItems. For ProductVariants
which are configured to track stock levels, the `ProductVariant.stockAllocated` value is
reduced, indicating that this stock is once again available to buy.

</div>
