Skip to main content
Skip to main content

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

inventoryItemIdstringRequired
The ID of the inventory item.
locationIdstringRequired
The ID of the location.
The attributes to update in the location level.
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<InventoryLevelDTO>Required
The updated inventory level's details.
Was this section helpful?