2.2 KiB
2.2 KiB
Class: InventoryService
Hierarchy
-
"medusa-interfaces"↳
InventoryService
Constructors
constructor
• new InventoryService(__namedParameters)
Parameters
| Name | Type |
|---|---|
__namedParameters |
Object |
Overrides
BaseService.constructor
Defined in
Methods
adjustInventory
▸ adjustInventory(variantId, adjustment): Promise<any>
Updates the inventory of a variant based on a given adjustment.
Parameters
| Name | Type | Description |
|---|---|---|
variantId |
string |
the id of the variant to update |
adjustment |
number |
the number to adjust the inventory quantity by |
Returns
Promise<any>
resolves to the update result.
Defined in
confirmInventory
▸ confirmInventory(variantId, quantity): Promise<boolean>
Checks if the inventory of a variant can cover a given quantity. Will
return true if the variant doesn't have managed inventory or if the variant
allows backorders or if the inventory quantity is greater than quantity.
Parameters
| Name | Type | Description |
|---|---|---|
variantId |
string |
the id of the variant to check |
quantity |
number |
the number of units to check availability for |
Returns
Promise<boolean>
true if the inventory covers the quantity
Defined in
withTransaction
▸ withTransaction(transactionManager): InventoryService
Parameters
| Name | Type |
|---|---|
transactionManager |
any |