ProductVariantInventoryService
internal.internal.ProductVariantInventoryService
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>getAvailabilityContext
anyRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
adjustInventory
adjustInventory(variantId
, locationId
, quantity
): Promise
<void
>
Adjusts inventory of a variant on a location
Parameters
variantId
stringRequiredlocationId
stringRequiredquantity
numberRequiredReturns
Promise
<void
>
Promise
Promise<void>RequiredadjustReservationsQuantityByLineItem
adjustReservationsQuantityByLineItem(lineItemId
, variantId
, locationId
, quantity
): Promise
<void
>
Adjusts the quantity of reservations for a line item by a given amount.
Parameters
lineItemId
stringRequiredvariantId
stringRequiredlocationId
stringRequiredquantity
numberRequiredReturns
Promise
<void
>
Promise
Promise<void>RequiredatomicPhase_
Protected
atomicPhase_<TResult
, TError
>(work
, isolationOrErrorHandler?
, maybeErrorHandlerOrDontFail?
): Promise
<TResult
>
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
<TResult
>
Promise
Promise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
attachInventoryItem
attachInventoryItem(attachments
): Promise
<ProductVariantInventoryItem
[]>
Attach a variant to an inventory item
Parameters
attachments
{ inventoryItemId: string ; requiredQuantity?: number ; variantId: string }[]RequiredReturns
Promise
<ProductVariantInventoryItem
[]>
the variant inventory item
attachInventoryItem(variantId
, inventoryItemId
, requiredQuantity?
): Promise
<ProductVariantInventoryItem
[]>
Parameters
variantId
stringRequiredinventoryItemId
stringRequiredrequiredQuantity
numberReturns
Promise
<ProductVariantInventoryItem
[]>
confirmInventory
confirmInventory(variantId
, quantity
, context?
): Promise
<Boolean
>
confirms if requested inventory is available
Parameters
variantId
stringRequiredquantity
numberRequiredcontext
objectcontext.salesChannelId
null | stringReturns
Promise
<Boolean
>
boolean indicating if inventory is available
deleteReservationsByLineItem
deleteReservationsByLineItem(lineItemId
, variantId
, quantity
): Promise
<void
>
delete a reservation of variant quantity
Parameters
lineItemId
string | string[]RequiredvariantId
stringRequiredquantity
numberRequiredReturns
Promise
<void
>
Promise
Promise<void>RequireddetachInventoryItem
detachInventoryItem(inventoryItemId
, variantId?
): Promise
<void
>
Remove a variant from an inventory item
Parameters
inventoryItemId
stringRequiredvariantId
stringReturns
Promise
<void
>
Promise
Promise<void>RequiredgetVariantQuantityFromVariantInventoryItems
getVariantQuantityFromVariantInventoryItems(variantInventoryItems
, channelId
): Promise
<number
>
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
<number
>
Promise
Promise<number>RequiredThe available quantity of the variant from the inventoryItems
Promise
Promise<number>RequiredlistByItem
listByItem(itemIds
): Promise
<ProductVariantInventoryItem
[]>
list registered inventory items
Parameters
itemIds
string[]RequiredReturns
Promise
<ProductVariantInventoryItem
[]>
list of inventory items
listByVariant
listByVariant(variantId
): Promise
<ProductVariantInventoryItem
[]>
List inventory items for a specific variant
Parameters
variantId
string | string[]RequiredReturns
Promise
<ProductVariantInventoryItem
[]>
variant inventory items for the variant id
listInventoryItemsByVariant
listInventoryItemsByVariant(variantId
): Promise
<InventoryItemDTO
[]>
lists inventory items for a given variant
Parameters
variantId
stringRequiredReturns
Promise
<InventoryItemDTO
[]>
lidt of inventory items for the variant
listVariantsByItem
listVariantsByItem(itemId
): Promise
<ProductVariant
[]>
lists variant by inventory item id
Parameters
itemId
stringRequiredReturns
Promise
<ProductVariant
[]>
a list of product variants that are associated with the item id
reserveQuantity
reserveQuantity(variantId
, quantity
, context?
): Promise
<void
| ReservationItemDTO
[]>
Reserves a quantity of a variant
Parameters
variantId
stringRequiredquantity
numberRequiredcontext
ReserveQuantityContextReturns
Promise
<void
| ReservationItemDTO
[]>
retrieve
retrieve(inventoryItemId
, variantId
): Promise
<ProductVariantInventoryItem
>
Retrieves a product variant inventory item by its inventory item ID and variant ID.
Parameters
inventoryItemId
stringRequiredvariantId
stringRequiredReturns
Promise
<ProductVariantInventoryItem
>
A promise that resolves with the product variant inventory item.
setProductAvailability
setProductAvailability(products
, salesChannelId
): Promise
<(Product
| PricedProduct
)[]>
Parameters
salesChannelId
undefined | string | string[]RequiredReturns
Promise
<(Product
| PricedProduct
)[]>
setVariantAvailability
setVariantAvailability(variants
, salesChannelId
, availabilityContext?
): Promise
<ProductVariant
[] | PricedVariant
[]>
Parameters
Returns
Promise
<ProductVariant
[] | PricedVariant
[]>
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
validateInventoryAtLocation
validateInventoryAtLocation(items
, locationId
): Promise
<void
>
Validate stock at a location for fulfillment items
Parameters
Returns
Promise
<void
>
Promise
Promise<void>RequiredwithTransaction
withTransaction(transactionManager?
): ProductVariantInventoryService
Parameters
transactionManager
EntityManagerReturns
ProductVariantInventoryService