Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Starts a commodity item purchase.

C_AuctionHouse.StartCommoditiesPurchase(itemID, quantity)

Arguments[]

itemID
number
quantity
number

Details[]

Example[]

  • Buys 3x Wool Cloth and uses a delay to wait for the auction house to process.
function Example() -- /run Example()
	C_AuctionHouse.StartCommoditiesPurchase(2592, 3)
	C_Timer.After(.5, function() C_AuctionHouse.ConfirmCommoditiesPurchase(2592, 3) end)
end
local item = {}

function TestPurchaseCommodity(itemID, quantity)
	C_AuctionHouse.StartCommoditiesPurchase(itemID, quantity)
	item.itemID = itemID
	item.quantity = quantity
end

local function OnEvent(self, event)
	if next(item) then
		C_AuctionHouse.ConfirmCommoditiesPurchase(item.itemID, item.quantity)
		wipe(item)
	end
end

local f = CreateFrame("Frame")
f:RegisterEvent("AUCTION_HOUSE_THROTTLED_SYSTEM_READY")
f:SetScript("OnEvent", OnEvent)

-- /run TestPurchaseCommodity(2592, 2)
  • Presses the "Buy" button, in a macro suitable format which uses a secure template. Split into two parts since it doesn't fit within <255 chars.

1. Initializes the secure template.

/run if not AHBuyC then local f=CreateFrame("Button","AHBuyC",nil,"SecureActionButtonTemplate")f:SetAttribute("type","click")f:SetAttribute("clickbutton",AuctionHouseFrame.CommoditiesBuyFrame.BuyDisplay.BuyButton)end

2. Buys the commodity items.

/click AHBuyC LeftButton 1
/run C_Timer.After(1, function() AuctionHouseFrame.BuyDialog.BuyNowButton:Click() end)

Patch changes[]

Shadowlands Patch 9.1.5 (2021-11-02): Protected when called from a (macro) script.
Battle for Azeroth Patch 8.3.0 (2020-01-14): Added.

See also[]


Advertisement