Support » Plugin: WooCommerce » How to Export Customer Emails from phpMyAdmin

  • Resolved patjk

    (@patjk)


    Hello,
    How to Export Customer Emails from phpMyAdmin? I want to export a spreadsheet of all emails of customers who purchased (so order is set to complete or processing). Can I please get the SQL query to do this?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • linux4me2

    (@linux4me2)

    How about this, which works if your data table prefix is set to “wp_”:

    
    SELECT wp_users.ID, wp_users.user_email FROM wp_users WHERE wp_users.ID IN(SELECT DISTINCT wp_postmeta.meta_value FROM wp_postmeta LEFT JOIN wp_posts ON wp_postmeta.post_id = wp_posts.ID LEFT JOIN wp_woocommerce_order_items ON wp_posts.ID = wp_woocommerce_order_items.order_id LEFT JOIN wp_woocommerce_order_itemmeta ON wp_woocommerce_order_itemmeta.order_item_id =  wp_woocommerce_order_items.order_item_id WHERE wp_posts.post_status IN('wc-completed', 'wc-processing') AND wp_woocommerce_order_itemmeta.meta_key = '_product_id' AND wp_postmeta.meta_key = '_customer_user')
    

    If you’re using some other table prefix, or none at all, you can use a text editor to do a search-and-replace for the “wp_”.

    Plugin Support Kenin

    (@kbassart)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.