Skip to main content
Skip to main content

retrieveAvailableQuantity - Inventory Module Reference

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

This method is used to retrieve the available quantity of an inventory item within the specified locations.

Example

import { 
initialize as initializeInventoryModule,
} from "@medusajs/inventory"

async function retrieveAvailableQuantity (
inventoryItemId: string,
locationIds: string[],
) {
const inventoryModule = await initializeInventoryModule({})

const quantity = await inventoryModule.retrieveAvailableQuantity(
inventoryItemId,
locationIds,
)

// do something with the quantity or return it
}

Parameters

inventoryItemIdstringRequired
The ID of the inventory item to retrieve its quantity.
locationIdsstring[]Required
The IDs of the locations to retrieve the available quantity from.
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<number>Required
The available quantity of the inventory item in the specified locations.
Was this section helpful?