Warcraft 2 isn't for sale anymore on Blizzard's store, but I would like to play the Battle.net version. Is it still playable on Battle.net, or is online play no longer supported?
Yes, it is still possible. Blizzard has re-released Warcraft II Battle.net Edition, with support for Windows 10, in the GOG store. It still includes support for the classic Battle.net multiplayer servers.
Before playing online with this version, you'll need to manually enter your "CD key" under the "Change CD Key" menu in the launcher. You can find your CD key by opening your GOG account page in your browser, clicking on "Warcraft II Battle.net Edition", and selecting "Serial Keys" from the "More" menu. It also asks for your name, but you don't need to use your real name and probably shouldn't for privacy reasons: it can be displayed to another user if they somehow try to use your CD key.
To play on Battle.net you must use the "Warcraft II (Classic)" option in the launcher. This ignores your choices under the Video Settings menu, but the other "WarCraft II" option doesn't even have Battle.net in its multiplayer menu. You will also need to create a Battle.net Classic account in the game. Battle.net Classic accounts are not connected to GOG accounts or modern Battle.net accounts.
You may also need to manually configure your router to forward ports 6112-6119 TCP/UDP to your computer. Modern games can often automatically configure ports using UPnP, but that hasn't been added to Warcraft II.
Outside of Battle.net, there also exists an unofficial multiplayer server and community called War2.ru, who provide an unofficial modified client called War2Combat. Unlike Battle.net, War2Combat does support UPnP, and War2.ru has a rudimentary online match history.
The battle.net version still works online. You might have issues finding people to play with but you are still able to connect. You won't be able to join a chat room however (probably just thevoid - which if you remember is the channel you went to when kicked or banned out of a channel) which happened when bots were emulate Warcraft II and Diablo I. Such fun. But I did play a game of Warcraft II online on Battle.net about a year ago. But had a decent wait to find someone!
While Blizzard's tech support info is sometimes out-of-date, playing on Battle.net and resolving issues with it is mentioned repeatedly in their tech support docs for Warcraft II. Due to this, I would expect that it can still be played on Battle.net.