ProductVariantInventoryService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__container__
anyRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredfeatureFlagRouter_
FlagRouterRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredinventoryService_
Returns
IInventoryService
objectRequiredstockLocationService_
Returns
IStockLocationService
objectRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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>RequiredconfirmInventory
confirms if requested inventory is available
Parameters
variantId
stringRequiredquantity
numberRequiredcontext
objectRequiredDefault: {}
context.salesChannelId
null | stringReturns
Promise
Promise<Boolean>Requiredretrieve
Retrieves a product variant inventory item by its inventory item ID and variant ID.
Parameters
inventoryItemId
stringRequiredvariantId
stringRequiredReturns
listByItem
list registered inventory items
Parameters
itemIds
string[]RequiredReturns
listByVariant
List inventory items for a specific variant
Parameters
variantId
string | string[]RequiredReturns
listVariantsByItem
lists variant by inventory item id
Parameters
itemId
stringRequiredReturns
listInventoryItemsByVariant
lists inventory items for a given variant
Parameters
variantId
stringRequiredReturns
attachInventoryItem
**attachInventoryItem**(attachments): Promise<[ProductVariantInventoryItem](../../entities/classes/entities.ProductVariantInventoryItem.mdx)[]>
Attach a variant to an inventory item
Parameters
attachments
object[]RequiredReturns
**attachInventoryItem**(variantId, inventoryItemId, requiredQuantity?): Promise<[ProductVariantInventoryItem](../../entities/classes/entities.ProductVariantInventoryItem.mdx)[]>
Parameters
variantId
stringRequiredinventoryItemId
stringRequiredrequiredQuantity
numberReturns
detachInventoryItem
Remove a variant from an inventory item
Parameters
inventoryItemId
stringRequiredvariantId
stringReturns
Promise
Promise<void>RequiredreserveQuantity
Reserves a quantity of a variant
Parameters
variantId
stringRequiredquantity
numberRequiredcontext
ReserveQuantityContextRequiredDefault: {}
Returns
adjustReservationsQuantityByLineItem
Adjusts the quantity of reservations for a line item by a given amount.
Parameters
lineItemId
stringRequiredvariantId
stringRequiredlocationId
stringRequiredquantity
numberRequiredReturns
Promise
Promise<void>RequiredvalidateInventoryAtLocation
Validate stock at a location for fulfillment items
Parameters
locationId
stringRequiredReturns
Promise
Promise<void>RequireddeleteReservationsByLineItem
delete a reservation of variant quantity
Parameters
lineItemId
string | string[]RequiredvariantId
stringRequiredquantity
numberRequiredReturns
Promise
Promise<void>RequiredadjustInventory
Adjusts inventory of a variant on a location
Parameters
variantId
stringRequiredlocationId
stringRequiredquantity
numberRequiredReturns
Promise
Promise<void>RequiredsetVariantAvailability
Parameters
salesChannelId
undefined | string | string[]RequiredavailabilityContext
AvailabilityContextRequiredDefault: {}
Returns
getAvailabilityContext
Parameters
variants
string[]RequiredsalesChannelId
undefined | string | string[]RequiredexistingContext
AvailabilityContextRequiredDefault: {}
Returns
Promise
Promise<Required<AvailabilityContext>>RequiredsetProductAvailability
Parameters
salesChannelId
undefined | string | string[]RequiredReturns
getVariantQuantityFromVariantInventoryItems
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>Required