Last active
April 1, 2016 17:23
-
-
Save emarket-design/7bba876a0f2988832d333956f45a572f to your computer and use it in GitHub Desktop.
How to get all order ids of a customer in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(is_user_logged_in()){ | |
$cust_orders = get_posts( array( | |
'numberposts' => -1, | |
'meta_key' => '_customer_user', | |
'meta_value' => get_current_user_id(), | |
'fields' => 'ids', | |
'post_type' => wc_get_order_types(), | |
'post_status' => array_keys( wc_get_order_statuses() ), | |
'orderby' => 'date', | |
'order' => 'DESC' | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment