Retrieving A List Of Customer Emails From WooCommerce

Recently I had cause to retrieve a list of customer emails (which due to guest checkout functionality is not the same as a list of user emails) from a WooCommerce installation. A quick search suggested that the easiest way was to install a plugin to do the job. I hate installing plugins on WordPress unless absolutely necessary (as half of them, including this one, are very badly maintained and thus either a security risk, a performance risk, or both).

Instead, the SQL query to retrieve this information, as well as a count of how many orders each customer has made, took only a few minutes to prepare and run:

Liked this? Here's some more: