ProductVariantInventoryService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>eventBusService_
IEventBusServiceRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredinventoryService_
Returns
IInventoryService
objectRequiredstockLocationService_
Returns
IStockLocationService
objectRequiredMethods
adjustInventory
Adjusts inventory of a variant on a location
Parameters
variantId
stringRequiredlocationId
stringRequiredquantity
numberRequiredReturns
Promise
Promise<void>RequiredadjustReservationsQuantityByLineItem
Adjusts the quantity of reservations for a line item by a given amount.
Parameters
lineItemId
stringRequiredvariantId
stringRequiredlocationId
stringRequiredquantity
numberRequiredReturns
Promise
Promise<void>RequiredatomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredattachInventoryItem
**attachInventoryItem**(attachments): Promise<[ProductVariantInventoryItem](/references/entities/classes/ProductVariantInventoryItem)[]>
Attach a variant to an inventory item
Parameters
attachments
object[]RequiredReturns
**attachInventoryItem**(variantId, inventoryItemId, requiredQuantity?): Promise<[ProductVariantInventoryItem](/references/entities/classes/ProductVariantInventoryItem)[]>
Parameters
variantId
stringRequiredinventoryItemId
stringRequiredrequiredQuantity
numberReturns
confirmInventory
confirms if requested inventory is available
Parameters
variantId
stringRequiredquantity
numberRequiredcontext
objectRequiredDefault: {}
context.salesChannelId
null | stringReturns
Promise
Promise<Boolean>RequireddeleteReservationsByLineItem
delete a reservation of variant quantity
Parameters
lineItemId
string | string[]RequiredvariantId
stringRequiredquantity
numberRequiredReturns
Promise
Promise<void>RequireddetachInventoryItem
Remove a variant from an inventory item
Parameters
inventoryItemId
stringRequiredvariantId
stringReturns
Promise
Promise<void>RequiredgetAvailabilityContext
Parameters
variants
string[]RequiredsalesChannelId
undefined | string | string[]RequiredexistingContext
AvailabilityContextRequiredDefault: {}
Returns
Promise
Promise<Required<AvailabilityContext>>RequiredgetVariantQuantityFromVariantInventoryItems
Get the quantity of a variant from a list of variantInventoryItems The inventory quantity of the variant should be equal to the inventory item with the smallest stock, adjusted for quantity required to fulfill the given variant.
Parameters
channelId
stringRequiredReturns
Promise
Promise<number>RequiredlistByItem
list registered inventory items
Parameters
itemIds
string[]RequiredReturns
listByVariant
List inventory items for a specific variant
Parameters
variantId
string | string[]RequiredReturns
listInventoryItemsByVariant
lists inventory items for a given variant
Parameters
variantId
stringRequiredReturns
listVariantsByItem
lists variant by inventory item id
Parameters
itemId
stringRequiredReturns
reserveQuantity
Reserves a quantity of a variant
Parameters
variantId
stringRequiredquantity
numberRequiredcontext
ReserveQuantityContextRequiredDefault: {}
Returns
retrieve
Retrieves a product variant inventory item by its inventory item ID and variant ID.
Parameters
inventoryItemId
stringRequiredvariantId
stringRequiredReturns
setProductAvailability
Parameters
salesChannelId
undefined | string | string[]RequiredReturns
setVariantAvailability
Parameters
salesChannelId
undefined | string | string[]RequiredavailabilityContext
AvailabilityContextRequiredDefault: {}
Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanvalidateInventoryAtLocation
Validate stock at a location for fulfillment items
Parameters
locationId
stringRequiredReturns
Promise
Promise<void>RequiredwithTransaction
Parameters
transactionManager
EntityManagerReturns
ProductVariantInventoryService
objectRequired