Wordpress Version 5.3.2 Woocommerce Version 3.8.1
To acheive Show user his purchased orders along with order_items (products in the order)
What I have tried
Saw How to get WooCommerce order details , Get some order and order items data in Woocommerce emails ,https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query
Still couldn't solve my issue.
Error I am facing
Fatal error: Uncaught Error: Call to a member function get_id() on array
Code
//got the user
$user = wp_get_current_user();
//In my case $user->ID returns 1
$args = array(
'customer_id' => $user->ID,
'status' => 'confirmed',
);
//Since i only want the confirmed orders
$order= wc_get_orders( $args );
$order_id = $order->get_id();