1---2name: wow-api-items-inventory3description: Complete reference for WoW Retail Item, Container (Bag), Bank, Loot, Equipment, Socket, Upgrade, Merchant, and World Loot Object APIs. Covers C_Item info/count/cooldown/equip/type checks, C_Container bag slots/sort/search/use, C_Bank tabs/deposit/withdraw, C_Loot roll/legacy mode, C_ItemSocketInfo gem sockets, C_ItemInteraction conversion, C_MerchantFrame vendor buy/sell/repair, item location/mixin patterns, and looting functions. Use when working with items, bags, inventory, bank, loot, equipment sets, item sockets, item upgrades, merchants, vendors, item links, or world loot objects.4---5
6# Item & Inventory API (Retail — Patch 12.0.0)
7
8Comprehensive reference for all Item, Container, Bank, Loot, Equipment, Merchant, Socket, Upgrade, and related APIs. Covers item information, bag management, banking, looting, equipment, gem sockets, item upgrades, merchant interactions, and world loot objects.
9
10> **Source:** https://warcraft.wiki.gg/wiki/World_of_Warcraft_API
11> **Current as of:** Patch 12.0.0 (Build 65655) — January 28, 2026
12> **Scope:** Retail only. No deprecated or removed functions.
13
14## Scope
15
16This skill covers these API systems:
17
18- **C_Item** — Item information, counts, cooldowns, equipping, type checks, transmog info
19- **C_Container** — Bag slot management, item queries, sorting, searching, using items
20- **C_Bank** — Bank tab management, deposits, withdrawals, account bank
21- **C_Loot** — Loot roll duration, legacy loot mode
22- **C_ItemSocketInfo** — Gem socket management
23- **C_ItemInteraction** — Item conversion/interaction UI
24- **C_MerchantFrame** — Vendor buy/sell/repair
25- **C_WorldLootObject** — World loot object queries
26- **ItemLocation / ItemMixin** — Item location handling patterns
27- **Global Inventory Functions** — PickupInventoryItem, EquipItemByName, UseInventoryItem, etc.
28- **Looting Functions** — LootSlot, GetNumLootItems, RollOnLoot, ConfirmLootRoll, etc.
29- **Equipment Sets** — C_EquipmentSet functions
30
31## When to Use This Skill
32
33Use this skill when you need to:
34- Query item info: name, link, icon, quality, type, subtype, level
35- Check item counts, cooldowns, or usability
36- Equip or use items programmatically
37- Manage bag contents: enumerate slots, sort, search, move items
38- Interact with the bank: deposit, withdraw, purchase tabs
39- Handle loot windows and loot rolls
40- Work with gem sockets and item upgrades
41- Buy from or sell to merchants
42- Check equipment sets
43- Handle world loot objects (e.g., loot on the ground)
44
45---
46
47## C_Item — Core Item API
48
49The `C_Item` namespace provides comprehensive item data access. Items are identified by `itemInfo` (itemID, itemName, or itemLink) or `ItemLocation` (bag + slot).
50
51> **Wiki:** https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Item
52
53### Item Information
54
55| Function | Returns | Description |
56|----------|---------|-------------|
57| `C_Item.GetItemInfo(itemInfo)` | `itemName, itemLink, quality, itemLevel, reqLevel, class, subclass, maxStack, equipLoc, icon, vendorPrice, classID, subClassID, bindType, expacID, setID, isCraftingReagent` | Full item data (may require server query) |
58| `C_Item.GetItemInfoInstant(itemInfo)` | `itemID, itemType, itemSubType, itemEquipLoc, icon, classID, subClassID` | Instant item data (no server query needed) |
59| `C_Item.GetItemName(itemLocation)` | `itemName` | Name from ItemLocation |
60| `C_Item.GetItemLink(itemLocation)` | `itemLink` | Hyperlink from ItemLocation |
61| `C_Item.GetItemIcon(itemLocation)` | `icon` | Icon texture from ItemLocation |
62| `C_Item.GetItemIconByID(itemInfo)` | `icon` | Icon texture by item ID/name/link |
63| `C_Item.GetItemQualityByID(itemInfo)` | `quality` | Quality enum value |
64| `C_Item.GetItemQualityColor(quality)` | `r, g, b, hex` | Color for item quality |
65| `C_Item.GetCurrentItemLevel(itemLocation)` | `currentItemLevel` | Effective item level |
66| `C_Item.GetItemClassInfo(itemClassID)` | `result` | Name of item class (Armor, Weapon, etc.) |
67| `C_Item.GetItemSubClassInfo(itemClassID, itemSubClassID)` | `subClassName, isArmorType` | Subclass name |
68| `C_Item.GetItemFamily(itemInfo)` | `result` | Bag type flags for the item |
69| `C_Item.GetItemGUID(itemLocation)` | `itemGUID` | Unique item GUID |
70| `C_Item.GetItemCreationContext(itemInfo)` | `itemID, creationContext` | How the item was created |
71| `C_Item.GetItemUpgradeInfo(itemInfo)` | `itemUpgradeInfo` | Upgrade track and level |
72| `C_Item.GetItemUniqueness(itemInfo)` | `limitCategory, limitMax` | Unique-equip limits |
73| `C_Item.GetItemUniquenessByID(itemInfo)` | `isUnique, limitCategoryName, limitCategoryCount, limitCategoryID` | Detailed uniqueness |
74
75### Item Counts & Cooldowns
76
77| Function | Returns | Description |
78|----------|---------|-------------|
79| `C_Item.GetItemCount(itemInfo [, includeBank [, includeUses [, includeReagentBank [, includeAccountBank]]]])` | `count` | Total item count across inventories |
80| `C_Item.GetItemCooldown(itemInfo)` | `startTimeSeconds, durationSeconds, enableCooldownTimer` | Item use cooldown |
81| `C_Item.GetStackCount(itemLocation)` | `stackCount` | Stack count at a location |
82
83### Item Type Checks
84
85| Function | Returns | Description |
86|----------|---------|-------------|
87| `C_Item.DoesItemExist(emptiableItemLocation)` | `itemExists` | Item exists at location? |
88| `C_Item.DoesItemExistByID(itemInfo)` | `itemExists` | Item exists by ID? |
89| `C_Item.DoesItemContainSpec(itemInfo, classID [, specID])` | `result` | Suitable for spec? |
90| `C_Item.IsEquippableItem(itemInfo)` | `result` | Can be equipped? |
91| `C_Item.IsEquippedItem(itemInfo)` | `result` | Currently equipped? |
92| `C_Item.IsEquippedItemType(type)` | `result` | Item type currently equipped? |
93| `C_Item.IsConsumableItem(itemInfo)` | `result` | Is consumable? |
94| `C_Item.IsCosmeticItem(itemInfo)` | `result` | Is cosmetic? |
95| `C_Item.IsDecorItem(itemInfo)` | `isDecor` | Is housing decoration? |
96| `C_Item.IsCurioItem(itemInfo)` | `result` | Is delve curio? |
97| `C_Item.IsHelpfulItem(itemInfo)` | `result` | Usable on friendly units? |
98| `C_Item.IsHarmfulItem(itemInfo)` | `result` | Usable on hostile units? |
99| `C_Item.IsBound(itemLocation)` | `isBound` | Is soulbound? |
100| `C_Item.IsBoundToAccountUntilEquip(itemLocation)` | `isBoundToAccountUntilEquip` | Account-bound until equipped? |
101| `C_Item.IsItemBindToAccount(itemInfo)` | `isItemBindToAccount` | Account-bound? |
102| `C_Item.IsItemKeystoneByID(itemInfo)` | `isKeystone` | Is M+ keystone? |
103| `C_Item.IsItemInRange(itemInfo, targetToken)` | `result` | In usable range? `#nocombat` |
104| `C_Item.IsItemDataCached(itemLocation)` | `isCached` | Data available locally? |
105| `C_Item.IsItemDataCachedByID(itemInfo)` | `isCached` | Data cached by ID? |
106| `C_Item.IsCurrentItem(itemInfo)` | `result` | Currently active? |
107| `C_Item.IsDressableItemByID(itemInfo)` | `isDressableItem` | Can be previewed? |
108| `C_Item.IsAnimaItemByID(itemInfo)` | `isAnimaItem` | Is anima item? |
109| `C_Item.IsLocked(itemLocation)` | `isLocked` | Is locked (opening)? |
110
111### Item Actions
112
113| Function | Returns | Description |
114|----------|---------|-------------|
115| `C_Item.EquipItemByName(itemInfo [, dstSlot])` | — | Equips an item |
116| `C_Item.ConfirmOnUse()` | — | Confirms item use |
117| `C_Item.ConfirmBindOnUse()` | — | Confirms bind-on-use `#protected` |
118| `C_Item.ConfirmNoRefundOnUse()` | — | Confirms no-refund `#protected` |
119| `C_Item.EndRefund(type)` | — | Confirms non-refundable |
120| `C_Item.RequestLoadItemData(itemLocation)` | — | Requests server item data |
121| `C_Item.RequestLoadItemDataByID(itemInfo)` | — | Requests data by ID |
122
123### Item Transmog
124
125| Function | Returns | Description |
126|----------|---------|-------------|
127| `C_Item.GetAppliedItemTransmogInfo(itemLoc)` | `info` | Applied transmog |
128| `C_Item.GetBaseItemTransmogInfo(itemLoc)` | `info` | Base appearance |
129| `C_Item.GetCurrentItemTransmogInfo(itemLoc)` | `info` | Current visual |
130| `C_Item.GetItemLearnTransmogSet(itemInfo)` | `setID` | Transmog set this teaches |
131
132---
133
134## C_Container — Bag & Container API
135
136Manages bag slots, item queries, sorting, and item operations within bags.
137
138> **Wiki:** https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Container
139
140### Bag Constants
141
142| Constant | Value | Description |
143|----------|-------|-------------|
144| `Enum.BagIndex.Backpack` | 0 | Main backpack |
145| `Enum.BagIndex.BagSlot1..4` | 1–4 | Equipped bag slots |
146| `Enum.BagIndex.BankBag` | -1 | Main bank |
147| `Enum.BagIndex.BankBagSlot1..7` | 5–11 | Bank bag slots |
148| `Enum.BagIndex.ReagentBag` | 5 | Reagent bag slot |
149| `KEYRING_CONTAINER` | -2 | Keyring (legacy) |
150| `Enum.BagIndex.AccountBankTab1..5` | 13–17 | Account bank tabs |
151
152### Container Functions
153
154| Function | Returns | Description |
155|----------|---------|-------------|
156| `C_Container.GetContainerNumSlots(containerIndex)` | `numSlots` | Number of slots in bag |
157| `C_Container.GetContainerNumFreeSlots(bagIndex)` | `numFreeSlots, bagFamily` | Free slots and bag type |
158| `C_Container.GetContainerFreeSlots(containerIndex)` | `freeSlots` | Array of free slot indices |
159| `C_Container.GetContainerItemInfo(containerIndex, slotIndex)` | `containerInfo` | Full item info at slot |
160| `C_Container.GetContainerItemID(containerIndex, slotIndex)` | `containerID` | Item ID at slot |
161| `C_Container.GetContainerItemLink(containerIndex, slotIndex)` | `itemLink` | Item hyperlink at slot |
162| `C_Container.GetContainerItemQuestInfo(containerIndex, slotIndex)` | `questInfo` | Quest item status |
163| `C_Container.GetContainerItemCooldown(containerIndex, slotIndex)` | `startTime, duration, enable` | Item cooldown |
164| `C_Container.GetContainerItemDurability(containerIndex, slotIndex)` | `durability, maxDurability` | Durability |
165| `C_Container.GetContainerItemEquipmentSetInfo(containerIndex, slotIndex)` | `inSet, setList` | Equipment set membership |
166| `C_Container.GetContainerItemPurchaseInfo(containerIndex, slotIndex, isEquipped)` | `info` | Refund info |
167| `C_Container.HasContainerItem(containerIndex, slotIndex)` | `hasItem` | Slot occupied? |
168| `C_Container.GetBagName(bagIndex)` | `name` | Bag item name |
169| `C_Container.GetBagSlotFlag(bagIndex, flag)` | `isSet` | Bag filter flag |
170| `C_Container.IsContainerFiltered(containerIndex)` | `isFiltered` | Bag is filtered? |
171| `C_Container.IsBattlePayItem(containerIndex, slotIndex)` | `isBattlePayItem` | Store-bought item? |
172| `C_Container.ContainerIDToInventoryID(containerID)` | `inventoryID` | Convert bag ID to inventory slot |
173
174### Container Actions
175
176| Function | Description |
177|----------|-------------|
178| `C_Container.UseContainerItem(containerIndex, slotIndex [, unitToken [, bankType [, reagentBankOpen]]])` | Use/equip item in bag |
179| `C_Container.SplitContainerItem(containerIndex, slotIndex, amount)` | Split a stack |
180| `C_Container.PickupContainerItem(containerIndex, slotIndex)` | Pick up item to cursor |
181| `C_Container.SocketContainerItem(containerIndex, slotIndex)` | Open socket UI for item |
182| `C_Container.ShowContainerSellCursor(containerIndex, slotIndex)` | Show sell cursor |
183| `C_Container.ContainerRefundItemPurchase(containerIndex, slotIndex [, isEquipped])` | Refund item |
184| `C_Container.UseHearthstone()` | Use hearthstone |
185| `C_Container.SetItemSearch(searchString)` | Filter bags by search text |
186
187### Sorting & Settings
188
189| Function | Description |
190|----------|-------------|
191| `C_Container.SortBags()` | Sort all bags |
192| `C_Container.SortBankBags()` | Sort bank bags |
193| `C_Container.SortAccountBankBags()` | Sort account bank bags |
194| `C_Container.SortBank(bankType)` | Sort specific bank type |
195| `C_Container.SetBagSlotFlag(bagIndex, flag, isSet)` | Set bag filtering flag |
196| `C_Container.SetBackpackAutosortDisabled(disable)` | Disable backpack auto-sort |
197| `C_Container.SetBankAutosortDisabled(disable)` | Disable bank auto-sort |
198| `C_Container.GetBackpackAutosortDisabled()` | Check backpack auto-sort |
199| `C_Container.GetBankAutosortDisabled()` | Check bank auto-sort |
200| `C_Container.GetSortBagsRightToLeft()` | Sort direction |
201| `C_Container.SetSortBagsRightToLeft(enable)` | Set sort direction |
202| `C_Container.GetInsertItemsLeftToRight()` | Insert direction |
203| `C_Container.SetInsertItemsLeftToRight(enable)` | Set insert direction |
204| `C_Container.GetBackpackSellJunkDisabled()` | Auto-sell junk disabled? |
205
206---
207
208## C_Bank — Bank API
209
210Manages character bank, reagent bank, and account bank (Warband bank) tabs.
211
212> **Wiki:** https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Bank
213
214### Bank Functions
215
216| Function | Returns | Description |
217|----------|---------|-------------|
218| `C_Bank.CanUseBank(bankType)` | `canUseBank` | Bank type accessible? |
219| `C_Bank.CanViewBank(bankType)` | `canViewBank` | Can view bank? |
220| `C_Bank.AreAnyBankTypesViewable()` | `areAnyBankTypesViewable` | Any bank viewable? |
221| `C_Bank.FetchViewableBankTypes()` | `viewableBankTypes` | List of viewable types |
222| `C_Bank.FetchNumPurchasedBankTabs(bankType)` | `numPurchasedBankTabs` | Purchased tab count |
223| `C_Bank.FetchPurchasedBankTabIDs(bankType)` | `purchasedBankTabIDs` | Purchased tab ID list |
224| `C_Bank.FetchPurchasedBankTabData(bankType)` | `purchasedBankTabData` | Tab configuration data |
225| `C_Bank.FetchNextPurchasableBankTabData(bankType)` | `nextPurchasableTabData` | Next unlock info |
226| `C_Bank.FetchDepositedMoney(bankType)` | `amount` | Money stored in bank |
227| `C_Bank.FetchBankLockedReason(bankType)` | `reason` | Why bank is locked |
228| `C_Bank.CanPurchaseBankTab(bankType)` | `canPurchaseBankTab` | Can buy another tab? |
229| `C_Bank.HasMaxBankTabs(bankType)` | `hasMaxBankTabs` | All tabs purchased? |
230| `C_Bank.CanDepositMoney(bankType)` | `canDepositMoney` | Can deposit gold? |
231| `C_Bank.CanWithdrawMoney(bankType)` | `canWithdrawMoney` | Can withdraw gold? |
232| `C_Bank.IsItemAllowedInBankType(bankType, itemLocation)` | `isItemAllowedInBankType` | Item fits this bank? |
233| `C_Bank.DoesBankTypeSupportAutoDeposit(bankType)` | `doesBankTypeSupportAutoDeposit` | Supports auto-deposit? |
234| `C_Bank.DoesBankTypeSupportMoneyTransfer(bankType)` | `doesBankTypeSupportMoneyTransfer` | Supports money? |
235
236### Bank Actions
237
238| Function | Description |
239|----------|-------------|
240| `C_Bank.PurchaseBankTab(bankType)` | Purchase a bank tab |
241| `C_Bank.UpdateBankTabSettings(bankType, tabID, tabName, tabIcon, depositFlags)` | Update tab settings |
242| `C_Bank.AutoDepositItemsIntoBank(bankType)` | Auto-deposit items |
243| `C_Bank.DepositMoney(bankType, amount)` | Deposit money |
244| `C_Bank.WithdrawMoney(bankType, amount)` | Withdraw money |
245| `C_Bank.CloseBankFrame()` | Close bank |
246
247---
248
249## Loot API
250
251### C_Loot
252
253| Function | Returns | Description |
254|----------|---------|-------------|
255| `C_Loot.GetLootRollDuration(rollID)` | `duration` | Roll timer duration |
256| `C_Loot.IsLegacyLootModeEnabled()` | `isLegacyLootModeEnabled` | Legacy loot active? |
257
258### Global Loot Functions
259
260| Function | Returns | Description |
261|----------|---------|-------------|
262| `GetNumLootItems()` | `numLootItems` | Items in loot window |
263| `GetLootInfo()` | `info` | Loot slot info table |
264| `GetLootSlotInfo(lootSlot)` | `icon, name, quantity, currencyID, quality, locked, isQuestItem, questID, isActive` | Slot details |
265| `GetLootSlotLink(lootSlot)` | `itemLink` | Item link for loot slot |
266| `GetLootSlotType(lootSlot)` | `slotType` | Slot content type |
267| `GetLootSourceInfo(lootSlot)` | `guid, quantity` | Source of loot |
268| `LootSlot(slot)` | — | Loot the slot |
269| `LootSlotHasItem(lootSlot)` | `isLootItem` | Slot has item? |
270| `ConfirmLootSlot(slot)` | — | Confirm BoP loot |
271| `CloseLoot([errNum])` | — | Close loot window |
272| `IsFishingLoot()` | `isFishingLoot` | Loot from fishing? |
273| `GetOptOutOfLoot()` | `optedOut` | Auto-passing all loot? |
274| `SetOptOutOfLoot(optOut)` | — | Set auto-pass |
275
276### Loot Rolls
277
278| Function | Returns | Description |
279|----------|---------|-------------|
280| `RollOnLoot(rollID [, rollType])` | — | Roll/pass on loot |
281| `ConfirmLootRoll(rollID, roll)` | — | Confirm BoP roll |
282| `GetLootRollItemInfo(rollID)` | `texture, name, count, quality, ...` | Roll item details |
283| `GetLootRollItemLink(rollID)` | `itemLink` | Roll item link |
284| `GetLootRollTimeLeft(rollID)` | `timeLeft` | Roll time remaining |
285| `GetActiveLootRollIDs()` | `rollIDs` | Active roll IDs |
286| `GetLootThreshold()` | `threshold` | Group loot threshold |
287
288---
289
290## C_ItemSocketInfo — Socket API
291
292| Function | Returns | Description |
293|----------|---------|-------------|
294| `C_ItemSocketInfo.GetNumSockets()` | `numSockets` | Number of sockets |
295| `C_ItemSocketInfo.GetSocketTypes(index)` | `socketType` | Socket color/type |
296| `C_ItemSocketInfo.GetExistingSocketInfo(index)` | `name, icon, gemMatchesSocket` | Current gem info |
297| `C_ItemSocketInfo.GetExistingSocketLink(index)` | `existingSocketLink` | Current gem link |
298| `C_ItemSocketInfo.GetNewSocketInfo(index)` | `name, icon, gemMatchesSocket` | Proposed gem info |
299| `C_ItemSocketInfo.GetNewSocketLink(index)` | `newSocketLink` | Proposed gem link |
300| `C_ItemSocketInfo.GetSocketItemInfo()` | `name, icon, quality` | Item being socketed |
301| `C_ItemSocketInfo.GetSocketItemBoundTradeable()` | `socketItemTradeable` | Still tradeable? |
302| `C_ItemSocketInfo.GetSocketItemRefundable()` | `socketItemRefundable` | Still refundable? |
303| `C_ItemSocketInfo.HasBoundGemProposed()` | `hasBoundGemProposed` | BoP gem selected? |
304| `C_ItemSocketInfo.GetCurrUIType()` | `uiType` | Socket UI type |
305| `C_ItemSocketInfo.IsArtifactRelicItem(info)` | `isArtifactRelicItem` | Is relic? (Legacy) |
306| `C_ItemSocketInfo.AcceptSockets()` | — | Apply gem changes |
307| `C_ItemSocketInfo.ClickSocketButton(index)` | — | Click a socket slot |
308| `C_ItemSocketInfo.CloseSocketInfo()` | — | Close socket UI |
309| `C_ItemSocketInfo.CompleteSocketing()` | — | Finalize socketing |
310
311---
312
313## C_ItemInteraction — Item Interaction UI
314
315| Function | Returns | Description |
316|----------|---------|-------------|
317| `C_ItemInteraction.GetItemInteractionInfo()` | `info` | Interaction frame info |
318| `C_ItemInteraction.GetItemInteractionSpellId()` | `spellId` | Spell for interaction |
319| `C_ItemInteraction.GetChargeInfo()` | `chargeInfo` | Charge tracking |
320| `C_ItemInteraction.GetItemConversionCurrencyCost(item)` | `conversionCost` | Currency cost |
321| `C_ItemInteraction.InitializeFrame()` | — | Initialize interaction |
322| `C_ItemInteraction.PerformItemInteraction()` | — | Execute interaction |
323| `C_ItemInteraction.ClearPendingItem()` | — | Clear selected item |
324| `C_ItemInteraction.CloseUI()` | — | Close UI |
325
326---
327
328## C_MerchantFrame — Merchant/Vendor API
329
330| Function | Returns | Description |
331|----------|---------|-------------|
332| `C_MerchantFrame.GetItemInfo(index)` | `itemInfo` | Vendor item info (12.0.0 replacement) |
333| `BuyMerchantItem(index [, quantity])` | — | Buy from vendor |
334| `BuybackItem(slot)` | — | Buy back sold item |
335| `CanMerchantRepair()` | `canRepair` | Vendor can repair? |
336| `RepairAllItems([guildBankRepair])` | — | Repair all items |
337| `GetRepairAllCost()` | `repairAllCost, canRepair` | Total repair cost |
338| `CloseMerchant()` | — | Close vendor window |
339| `GetMerchantNumItems()` | `numItems` | Number of vendor items |
340| `GetBuybackItemInfo(slotIndex)` | `name, icon, price, ...` | Buyback item info |
341| `GetNumBuybackItems()` | `numItems` | Buyback slot count |
342| `GetMerchantItemMaxStack(index)` | `maxStack` | Max purchasable stack |
343
344---
345
346## C_WorldLootObject — World Loot Objects
347
348| Function | Returns | Description |
349|----------|---------|-------------|
350| `C_WorldLootObject.IsWorldLootObject(unitToken)` | `isWorldLootObject` | Is world loot? |
351| `C_WorldLootObject.GetWorldLootObjectInfo(unitToken)` | `info` | Loot object details |
352| `C_WorldLootObject.GetWorldLootObjectInfoByGUID(objectGUID)` | `info` | Info by GUID |
353| `C_WorldLootObject.GetWorldLootObjectDistanceSquared(unitToken)` | `distanceSquared` | Distance to object |
354| `C_WorldLootObject.DoesSlotMatchInventoryType(slot, inventoryType)` | `matches` | Slot/type match? |
355
356---
357
358## ItemLocation & ItemMixin Patterns
359
360### ItemLocation
361
362`ItemLocation` is used to reference items by their container position:
363
364```lua
365-- Create an ItemLocation for bag 0, slot 1
366local itemLoc = ItemLocation:CreateFromBagAndSlot(0, 1)
367
368-- Create for an equipped slot
369local itemLoc = ItemLocation:CreateFromEquipmentSlot(INVSLOT_HEAD)
370
371-- Check if it's valid
372if itemLoc:IsValid() then
373 local name = C_Item.GetItemName(itemLoc)
374end
375```
376
377### Item Data Loading (ContinuableContainer)
378
379```lua
380-- Items may not be cached — use the callback pattern
381local item = Item:CreateFromItemID(12345)
382item:ContinueOnItemLoad(function()
383 local name = item:GetItemName()
384 local link = item:GetItemLink()
385 local icon = item:GetItemIcon()
386 print(name, link)
387end)
388```
389
390### Batch Loading
391
392```lua
393local container = ContinuableContainer:Create()
394for _, itemID in ipairs(itemIDs) do
395 local item = Item:CreateFromItemID(itemID)
396 container:AddContinuable(item)
397end
398container:ContinueOnLoad(function()
399 -- All items are now cached
400end)
401```
402
403---
404
405## Global Inventory Functions
406
407| Function | Description |
408|----------|-------------|
409| `PickupInventoryItem(slot)` | Pick up equipped item |
410| `UseInventoryItem(slot)` | Use equipped item |
411| `GetInventoryItemID(unit, slot)` | Get item ID in equipment slot |
412| `GetInventoryItemLink(unit, slot)` | Get item link in equipment slot |
413| `GetInventoryItemTexture(unit, slot)` | Get icon for equipment slot |
414| `GetInventoryItemQuality(unit, slot)` | Get quality for equipment slot |
415| `GetInventoryItemCount(unit, slot)` | Get stack count in equipment slot |
416| `GetInventoryItemDurability(slot)` | Get durability of equipped item |
417| `GetInventoryItemBroken(slot)` | Check if equipment is broken |
418| `GetInventorySlotInfo(slotName)` | Get slot index and texture |
419| `AutoEquipCursorItem()` | Auto-equip cursor item |
420| `EquipCursorItem(slot)` | Equip cursor item to slot |
421| `CancelPendingEquip(index)` | Cancel pending equip confirm |
422| `SocketInventoryItem(slot)` | Open socket UI for equipped item |
423
424---
425
426## Equipment Sets (C_EquipmentSet)
427
428| Function | Returns | Description |
429|----------|---------|-------------|
430| `C_EquipmentSet.GetEquipmentSetIDs()` | `setIDs` | All set IDs |
431| `C_EquipmentSet.GetEquipmentSetInfo(setID)` | `info` | Set name, icon, etc. |
432| `C_EquipmentSet.GetItemIDs(setID)` | `itemIDs` | Items in set by slot |
433| `C_EquipmentSet.GetItemLocations(setID)` | `itemLocations` | Item locations per slot |
434| `C_EquipmentSet.EquipmentSetContainsLockedItems(setID)` | `hasLockedItems` | Any items locked? |
435| `C_EquipmentSet.CreateEquipmentSet(name, icon)` | — | Create new set |
436| `C_EquipmentSet.SaveEquipmentSet(setID [, icon])` | — | Save current gear to set |
437| `C_EquipmentSet.UseEquipmentSet(setID)` | `result` | Equip a set |
438| `C_EquipmentSet.DeleteEquipmentSet(setID)` | — | Delete a set |
439| `C_EquipmentSet.ModifyEquipmentSet(setID, name [, icon])` | — | Rename/re-icon set |
440| `C_EquipmentSet.GetNumEquipmentSets()` | `numSets` | Count of sets |
441| `C_EquipmentSet.GetEquipmentSetForSlot(slot)` | `setIDs` | Sets using this slot |
442| `C_EquipmentSet.CanUseEquipmentSets()` | `canUse` | Equipment sets available? |
443
444---
445
446## Cursor Functions (Item-Related)
447
448| Function | Returns | Description |
449|----------|---------|-------------|
450| `ClearCursor()` | — | Clear cursor contents |
451| `CursorHasItem()` | `result` | Cursor holds item? |
452| `CursorHasMoney()` | `result` | Cursor holds money? |
453| `CursorHasSpell()` | `result` | Cursor holds spell? |
454| `GetCursorInfo()` | `type, ...` | What's on cursor |
455| `PickupBagFromSlot(slot)` | — | Pick up a bag |
456| `PickupItem(itemInfo)` | — | Pick up by ID/name |
457| `PickupMerchantItem(index)` | — | Pick up from merchant |
458| `DeleteCursorItem()` | — | Destroy cursor item |
459
460---
461
462## Common Patterns
463
464### Iterate All Bag Items
465
466```lua
467for bag = 0, 4 do
468 for slot = 1, C_Container.GetContainerNumSlots(bag) do
469 local info = C_Container.GetContainerItemInfo(bag, slot)
470 if info then
471 print(info.hyperlink, info.stackCount, info.quality)
472 end
473 end
474end
475```
476
477### Count Free Bag Slots
478
479```lua
480local totalFree = 0
481for bag = 0, 4 do
482 local free = C_Container.GetContainerNumFreeSlots(bag)
483 totalFree = totalFree + free
484end
485print("Free slots:", totalFree)
486```
487
488### Check If Player Has Item
489
490```lua
491local count = C_Item.GetItemCount(12345, true) -- includeBank
492if count > 0 then
493 print("You have", count, "of this item")
494end
495```
496
497### Auto-Sell Junk at Vendor
498
499```lua
500-- Register for MERCHANT_SHOW event
501for bag = 0, 4 do
502 for slot = 1, C_Container.GetContainerNumSlots(bag) do
503 local info = C_Container.GetContainerItemInfo(bag, slot)
504 if info and info.quality == Enum.ItemQuality.Poor then
505 C_Container.UseContainerItem(bag, slot)
506 end
507 end
508end
509```
510
511---
512
513## Key Events
514
515| Event | Payload | Description |
516|-------|---------|-------------|
517| `BAG_UPDATE` | `bagID` | Bag contents changed |
518| `BAG_UPDATE_DELAYED` | — | Fires after all BAG_UPDATE |
519| `ITEM_LOCK_CHANGED` | `bagOrSlotIndex, slotIndex` | Item lock state changed |
520| `ITEM_LOCKED` | `bagID, slotID` | Item became locked |
521| `ITEM_UNLOCKED` | `bagID, slotID` | Item unlocked |
522| `GET_ITEM_INFO_RECEIVED` | `itemID, success` | Async item data arrived |
523| `BANKFRAME_OPENED` | — | Bank window opened |
524| `BANKFRAME_CLOSED` | — | Bank window closed |
525| `PLAYERBANKSLOTS_CHANGED` | `slot` | Bank slot changed |
526| `PLAYERBANKBAGSLOTS_CHANGED` | — | Bank bag slots changed |
527| `LOOT_READY` | `autoLoot` | Loot window ready |
528| `LOOT_OPENED` | `autoLoot` | Loot window opened |
529| `LOOT_CLOSED` | — | Loot window closed |
530| `LOOT_SLOT_CLEARED` | `lootSlot` | Loot slot taken |
531| `START_LOOT_ROLL` | `rollID, rollTime, lootHandle` | Roll started |
532| `CONFIRM_LOOT_ROLL` | `rollID, roll, confirmReason` | Confirm BoP roll |
533| `LOOT_ROLL_COMPLETE` | `rollID` | Roll finished |
534| `MERCHANT_SHOW` | — | Vendor window opened |
535| `MERCHANT_CLOSED` | — | Vendor window closed |
536| `MERCHANT_UPDATE` | — | Vendor items updated |
537| `EQUIPMENT_SETS_CHANGED` | — | Equipment sets modified |
538| `EQUIPMENT_SWAP_FINISHED` | `result, setID` | Set swap done |
539| `ITEM_INTERACTION_OPEN` | — | Item interaction opened |
540| `ITEM_INTERACTION_CLOSE` | — | Item interaction closed |
541| `SOCKET_INFO_UPDATE` | — | Socket UI data updated |
542| `SOCKET_INFO_CLOSE` | — | Socket UI closed |
543| `ACCOUNT_BANK_TAB_PURCHASE_SUCCEEDED` | — | Account bank tab bought |
544
545---
546
547## Gotchas & Restrictions
548
5491. **Async item data** — `C_Item.GetItemInfo()` may return nil for uncached items. Use `C_Item.RequestLoadItemDataByID()` and listen for `GET_ITEM_INFO_RECEIVED`, or use the `Item:ContinueOnItemLoad()` mixin pattern.
5502. **Bag index 5** — In Retail, bag index 5 is the Reagent Bag slot, not a bank bag.
5513. **Account Bank** — Account bank tabs (Warband bank) use `Enum.BagIndex.AccountBankTab1..5` (indices 13–17). Check `C_PlayerInfo.IsAccountBankEnabled()`.
5524. **GetMerchantItemInfo removed** — Use `C_MerchantFrame.GetItemInfo(index)` in 12.0.0.
5535. **Protected functions** — `EquipItemByName`, `UseContainerItem`, and similar functions may be restricted during combat lockdown.
5546. **Item secrets** — In 12.0.0 instances, some item-related data may become secret values. Design UIs to pass values directly to widgets.
5557. **ContainerInfo structure** — `C_Container.GetContainerItemInfo()` returns a table with fields: `iconFileID`, `stackCount`, `isLocked`, `quality`, `isReadable`, `hasLoot`, `hyperlink`, `isFiltered`, `hasNoValue`, `itemID`, `isBound`.