API C AuctionHouse.StartCommoditiesPurchase

Starts a commodity item purchase.
 C_AuctionHouse.StartCommoditiesPurchase(itemID, quantity)
==Arguments==
:;itemID:
:;quantity:
==Details==
* The purchase is finalized with ()
==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
* Waits for instead of using a delay. Note that C_AuctionHouse.StartCommoditiesPurchase requires a hardware event.
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==
==See also==
* https://www.curseforge.com/wow/addons/magic-button/ - Adds macros for keybinds to buy, post, and cancel on the auction house.