---
displayed_sidebar: inventoryReference
slug: /references/inventory/retrieveStockedQuantity
sidebar_label: retrieveStockedQuantity
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# retrieveStockedQuantity - Inventory Module Reference

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

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

## Example

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

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

  const quantity = await inventoryModule.retrieveStockedQuantity(
    inventoryItemId,
    locationIds,
  )
  
  // do something with the quantity or return it
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "inventoryItemId",
    "type": "`string`",
    "description": "The ID of the inventory item to retrieve its stocked quantity.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "locationIds",
    "type": "`string`[]",
    "description": "The IDs of the locations to retrieve the stocked quantity from.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "context",
    "type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
    "description": "A context used to share resources, such as transaction manager, between the application and the module.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "manager",
        "type": "`EntityManager`",
        "description": "An instance of an entity manager.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "transactionManager",
        "type": "`EntityManager`",
        "description": "An instance of a transaction manager.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

## Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;number&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "The stocked quantity of the inventory item in the specified locations.",
    "expandable": false,
    "children": [
      {
        "name": "number",
        "type": "`number`",
        "optional": true,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />
