Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WoW Classic :: CB_VendorAutoBuy :: Automatically buy rare items from vendors
-- Copyright (c) 2019 "Cowboy" Ben Alman
-- Licensed under the MIT license
local frameName = "CB_VENDOR_AUTO_BUY_FRAME"
if not _G[frameName] then
_G[frameName] = CreateFrame("Frame")
local function Set(list)
local set = {}
for _, l in ipairs(list) do set[l] = true end
return set
local vendors = {
["Qia"] = Set {
"Pattern: Runecloth Gloves",
"Pattern: Runecloth Bag"
local function p(msg)
print("[CB_VendorAutoBuy] " .. msg)
local frame = _G[frameName]
frame:SetScript("OnEvent", function(self, event, ...)
if IsShiftKeyDown() then return end
local targetName = UnitName("target")
if not targetName then return end
local vendor = vendors[targetName]
if not vendor then return end
local numItems = GetMerchantNumItems()
for i = numItems, 1, -1 do
local name = GetMerchantItemInfo(i)
if vendor[name] then
p("Buying: " .. name)
pcall(function() BuyMerchantItem(i) end)
local count = 0
frame:SetScript("OnUpdate", function(self)
count = count + 1
if count > 10 then
frame:SetScript("OnUpdate", nil)
## Interface: 11302
## Title: CB_VendorAutoBuy
## Notes: Automatically buy rare items from vendors
## Author: Cowboy
## Version: v0.0.4

This comment has been minimized.

Copy link
Owner Author

cowboy commented Oct 4, 2019

  1. Create World of Warcraft\_classic_\Interface\Addons\CB_VendorAutoBuy folder and put these files in there
  2. Start WoW Classic
  3. Bind a key to Interact with target
  4. Target the vendor
  5. Press the key
  6. Repeat step 5 for the rest of your life


  • The addon will automatically close the merchant dialog after attempting to buy the item (so you can spam the key)
  • If there's another item in that merchant slot, the addon will mention it, but will not buy it
  • Hold Shift to prevent the addon from attempting to auto-buy the item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.