Show customer details on WooCommerce thank you page

If you are accepting guest orders on your WooCommerce store, after placing an order, guest users/not logged in users don’t see their details (customer details – billing/shipping addresses) on the thank you page. This can be confusing for some users, as they might be feeling comfortable seeing their billing/shipping address is put correctly.

We can show customer details for guest users by utilizing order/order-details-customer.php template with woocommerce_thankyou action hook.

function careless_woo_show_customers_details_on_thankyou( $order_id ) {
    //let's keep logged-in user functionality as it is
    if ( ! $order_id || is_user_logged_in() ) {

    //get WC_Order object
    $order = wc_get_order( $order_id );

    wc_get_template( 'order/order-details-customer.php', array('order' => $order ));
add_action( 'woocommerce_thankyou', 'careless_woo_show_customers_details_on_thankyou', 10, 1 );

Code goes in the functions.php file of your active theme.