I Want to show meta "email" of a customers each order, but this is throwing an error.
add_action( 'woocommerce_before_edit_account_address_form', 'save_billing_email_to_user', 12, 1 );
function save_billing_email_to_user( $user_id ) {
$query = new WC_Order_Query(
array(
'customer_id' => $user_id
)
);
$orders = $query->get_orders();
foreach($orders as $ro => $inn){
echo $ro['email'];
}
}
What Im doing wrong here?