Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to get all order ids of a customer in WooCommerce
$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
You can’t perform that action at this time.