Get orders of a specific customer woocommerce

Question

I want to get the orders of a specific customer based on their ID, no matter what the current status of order is, I just want to retrieve it.
I’m trying with the below method, but it always returns empty array.
I already made sure that this customer have some orders with completed status.

function getOrderOfUser(){
    $orders=wc_get_orders(array(
//      'customer_id'=>22,
        'status'=>'completed'
    ));
//  var_dump($orders);
    return $orders;
}

Any help will be highly appreciated.

0
, Lint 4 months 0 Answers 45 views 0

Leave an answer