Skip to content

Instantly share code, notes, and snippets.

@sarathlal-old
Last active July 27, 2018 13:53
Show Gist options
  • Save sarathlal-old/22a003f3965eaae40b3fe6b32812c36c to your computer and use it in GitHub Desktop.
Save sarathlal-old/22a003f3965eaae40b3fe6b32812c36c to your computer and use it in GitHub Desktop.
Get WoCommerce orders of a specific customer
$customer_id = get_current_user_id();
$customer_orders = get_posts( array(
'numberposts' => -1,
'meta_key' => '_customer_user',
'meta_value' => $customer_id,
'post_type' => wc_get_order_types(),
'post_status' => array_keys( wc_get_order_statuses() ),
//'post_status' => array('wc-completed'),
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment