get all orders by user id
$customer = wp_get_current_user();
// Get all customer orders
$customer_orders = get_posts(array(
'numberposts' => -1,
'meta_key' => '_customer_user',
'orderby' => 'date',
'order' => 'DESC',
'meta_value' => get_current_user_id(),
'post_type' => wc_get_order_types(),
'post_status' => array_keys(wc_get_order_statuses()), 'post_status' => array('wc-processing'),
));
$Order_Array = []; //
foreach ($customer_orders as $customer_order) {
$orderq = wc_get_order($customer_order);
$Order_Array[] = [
"ID" => $orderq->get_id(),
"Value" => $orderq->get_total(),
"Date" => $orderq->get_date_created()->date_i18n('Y-m-d'),
];
}