adjustInventory - Inventory Module Reference
This documentation provides a reference to the adjustInventory method. This belongs to the Inventory Module.
This method is used to adjust the inventory level's stocked quantity. The inventory level is identified by the IDs of its associated inventory item and location.
Example
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function adjustInventory (
inventoryItemId: string,
locationId: string,
adjustment: number
) {
const inventoryModule = await initializeInventoryModule({})
const inventoryLevel = await inventoryModule.adjustInventory(
inventoryItemId,
locationId,
adjustment
)
// do something with the inventory level or return it.
}
Parameters
inventoryItemIdstringRequiredThe ID of the associated inventory item.
locationIdstringRequiredThe ID of the associated location.
adjustmentnumberRequiredA positive or negative number used to adjust the inventory level's stocked quantity.
contextSharedContextA context used to share resources, such as transaction manager, between the application and the module.
contextSharedContextReturns
The inventory level's details.
Was this section helpful?