adjustInventory - Inventory Next Module Reference

This documentation provides a reference to the adjustInventory method. This belongs to the Inventory Next Module.

NoteYou should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.

adjustInventory(data, context?): Promise<InventoryLevelDTO[]>#

This method adjusts the inventory quantity of an item in a location.

Example#

Code
1const inventoryLevel1 =2  await inventoryModuleService.adjustInventory([3    // add to the inventory quantity4    {5      inventoryItemId: "iitem_123",6      locationId: "loc_123",7      adjustment: 58    },9    // subtract from the inventory quantity10    {11      inventoryItemId: "iitem_321",12      locationId: "loc_321",13      adjustment: -514    }15  ])

Parameters#

dataobject[]
The adjustments to make.
contextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<InventoryLevelDTO[]>
The updated inventory level.

adjustInventory(inventoryItemId, locationId, adjustment, context?): Promise<InventoryLevelDTO>#

Example#

Code
1// add to the inventory quantity2const inventoryLevel1 =3  await inventoryModuleService.adjustInventory(4    "iitem_123",5    "loc_123",6    57  )8
9// subtract from the inventory quantity10const inventoryLevel2 =11  await inventoryModuleService.adjustInventory(12    "iitem_123",13    "loc_123",14    -515  )

Parameters#

inventoryItemIdstring
The inventory item's ID.
locationIdstring
The location's ID.
adjustmentBigNumberInput
the adjustment to make to the quantity.
contextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<InventoryLevelDTO>
The updated inventory level.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break