> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get total item amount

> Returns the total amount of a specific item in an inventory, including items in containers.

Returns the total amount of a specific item in an inventory, including items in containers.

<CodeGroup>
  ```lua Export theme={null}
  exports['jaksam_inventory']:getTotalItemAmount(inventoryId, itemName, metadata, skipContainers)
  ```

  ```lua Example theme={null}
  -- Get total amount of bread in inventory
  local total = exports['jaksam_inventory']:getTotalItemAmount(1, 'bread')

  -- Get amount with specific metadata
  local total = exports['jaksam_inventory']:getTotalItemAmount(1, 'weapon_pistol', {
      serial = "ABC123"
  })

  -- Get amount excluding containers
  local total, totalNoContainers = exports['jaksam_inventory']:getTotalItemAmount(1, 'bread', nil, true)
  ```
</CodeGroup>

### Parameters

| Name             | Data Type        | Description                                                                                                       |
| ---------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------- |
| `inventoryId`    | string \| number | The inventory ID to check                                                                                         |
| `itemName`       | string           | The name of the item to count                                                                                     |
| `metadata`       | table            | Metadata to match against when counting (if provided, only items with the same metadata AND name will be counted) |
| `skipContainers` | boolean          | If true, items in containers will not be counted                                                                  |

### Return value

| Name                            | Data Type     | Description                                                                                       |
| ------------------------------- | ------------- | ------------------------------------------------------------------------------------------------- |
| `totalAmount`                   | number        | Total amount of the item in the inventory, including containers (only if skipContainers is false) |
| `totalAmountContainersExcluded` | number \| nil | Total amount excluding containers (only if skipContainers is false)                               |


## Related topics

- [Get total item amount](/jaksam-inventory/functions/client/get-total-item-amount.md)
- [Item added](/jaksam-inventory/hooks/on-item-added.md)
- [Client](/jaksam-inventory/functions/client/index.md)
- [Server](/jaksam-inventory/functions/server/index.md)
- [Get item from slot](/jaksam-inventory/functions/client/get-item-from-slot.md)
