I bought a WoW Legion DVD online but just realised my PC doesn't have a DVD reader. Does this come with a game key to install online or do I have to use the disc?
You can use the CD/DVD key on the official website to play the game. You don't need the CD/DVD itself in any way.
In fact, by using the CD/DVD for an MMORPG, the installation process may take you longer than simply downloading the game in the first place, because the CD/DVD likely has outdated data on it, as most online games are frequently updating themselves with new patches and expansions that you will need to end up downloading anyway.
In the current year of 2017, you can also download & play the game for free without any CD/DVD Key & without even finishing the entire download of the game, but in that case you will have limitations on what you can do, including not being able to level past a certain point, and not being able to do certain quests or visit certain areas. In the future this may change and more limitations may be lifted on free accounts.