updateInventoryLevel - Inventory Module Reference
This documentation provides a reference to the updateInventoryLevel
method. This belongs to the Inventory Module.
This method is used to update an inventory level. 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 updateInventoryLevel (
inventoryItemId: string,
locationId: string,
stockedQuantity: number
) {
const inventoryModule = await initializeInventoryModule({})
const inventoryLevel = await inventoryModule.updateInventoryLevels(
inventoryItemId,
locationId,
{
stocked_quantity: stockedQuantity
}
)
// do something with the inventory level or return it
}
Parameters
inventoryItemId
stringRequiredThe ID of the inventory item.
locationId
stringRequiredThe ID of the location.
The attributes to update in the location level.
context
SharedContextA context used to share resources, such as transaction manager, between the application and the module.
context
SharedContextReturns
The updated inventory level's details.
Was this section helpful?