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
inventoryItemId
stringRequiredThe ID of the associated inventory item.
locationId
stringRequiredThe ID of the associated location.
adjustment
numberRequiredA positive or negative number used to adjust the inventory level's stocked quantity.
context
SharedContextA context used to share resources, such as transaction manager, between the application and the module.
context
SharedContextReturns
The inventory level's details.
Was this section helpful?