To buy an item from a vendor with a macro in WoW, open the merchant window and press a macro containing /run BuyMerchantItem(index, quantity) - for example, /run BuyMerchantItem(4, 20) purchases 20 of the fourth item in the vendor's list. The index counts from 1 starting at the top-left of the merchant window, quantity is how many you want, and the same command works in both retail and Classic.
The macro, step by step
- Open the macro panel (type /macro or pick Macros from the game menu), create a new macro, and choose any icon.
- Paste this line: /run BuyMerchantItem(4, 20) - replace 4 with the item's slot number and 20 with the amount you want.
- Drag the macro onto an action bar.
- Talk to the vendor so the merchant window is open, then press the macro. Standard goods are bought instantly; bind-on-pickup gear may ask you to confirm first.
Slot numbering is simple: the first item on the vendor's first page is 1, the second is 2, and the count keeps going across pages - the first item on page two of a ten-slot layout is 11. For stackable goods each call is capped at one full stack, so loop the call (see below) when you need more than that.
How do I find the right slot number?
Let the game tell you. With the vendor open, run this once: /run for i=1,GetMerchantNumItems() do print(i, GetMerchantItemInfo(i)) end - it prints every slot number next to the item's name in your chat frame. Note the number, drop it into your buy macro, and you're done.
You can also skip slot numbers entirely and buy by name: /run local n="Arcane Powder" for i=1,GetMerchantNumItems() do if GetMerchantItemInfo(i)==n then BuyMerchantItem(i,10) end end. The name must match exactly, capitalization included. This version keeps working even if the vendor's list order changes between patches.
Can one press buy multiple stacks?
Yes. BuyMerchantItem is not a protected function, so a single press may run it several times in a loop: /run for x=1,5 do BuyMerchantItem(4,20) end buys five stacks of 20 in one click. That's the fast way to restock reagents, food, or crafting materials before a raid night - just check your bag space and gold first, because the only undo is the vendor's buyback tab.
Does this work in WoW Classic and Hardcore?
It does. BuyMerchantItem has been part of the scripting API since the game's earliest days, and the syntax is identical across Classic Era, Hardcore, Anniversary realms, and current retail. The one constraint everywhere is the 255-character macro limit - the buy-by-name version above fits, but only just, so keep item names short if you're bumping against the cap.
Is a vendor buy macro against Blizzard's rules?
No. It uses the official scripting API and fires once per key press, which is exactly what the macro system is built for. The line Blizzard draws is automation: anything that presses the button for you - software loops, hardware repeaters, unattended farming - puts your account at risk. One press, one purchase (or one scripted batch of purchases) is fine, and goldmakers and raiders have used it for years.
Macros like this save minutes; knowing what to restock, what actually sells, and how to squeeze more out of each session saves hours. If you'd rather have a vetted pro alongside you - a goldmaking and quality-of-life coaching session, or a rent-a-pro teammate for the content you're stocking up for - PewPewShop's human-only players do exactly that, with transparent pricing and a long zero-ban record.