Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How To Display Customer Order Details in WooCommerce

When processing a Woocommerce order, you often need information that is not available on the order page, thus, you need to switch pages or go to the customer database to get the information. Often, the most common information item is the customer username and profile.

By default WooCommerce order page shows limited information about the Orders in the admin panel.

In this tutorial, I will demonstrate how to display customer information on the order page. The good news is that all you have to do is to place a simple snippet at the end of the functions.php file of the theme.

add_action( 'woocommerce_admin_order_data_after_billing_address', 'wpblog_order_customer_information');
function wpblog_order_customer_information( $order ){
    global $post;
	$customer_user = get_post_meta( $post->ID, '_customer_user', true );
    echo '

'.__('Order Customer name').': ' . get_user_meta( $customer_user, 'customername', true ) . '

'; }

woocommerce_admin_order_data_after_billing_address is WooCommerce hook used to display admin data.
wpblog_order_customer_information is a function used to display user information through get_user_meta.

Get Customer Details From Orders – The Alternate Method

Here is another function that adds similar functionality and get customer information at the order page:

add_action( 'woocommerce_admin_order_data_after_billing_address', 'wpblog_anothermethod_display');
function wpblog_anothermethod_display( $order ){
    $order_id =43;
    $order_meta = get_post_meta($order_id);
"); }

$order_meta uses get_post_meta, which is meta key to return data on the basis of order_id.

Note: add the above code in functions.php which located in your theme folder or whenever you want to display the information about order details


In this short tutorial, I showed how you could easily add information to WooCommerce order page. If you need help, just drop a comment below.

The post How To Display Customer Order Details in WooCommerce appeared first on WPblog.

This post first appeared on WordPress Tutorials And Guides, please read the originial post: here

Share the post

How To Display Customer Order Details in WooCommerce


Subscribe to Wordpress Tutorials And Guides

Get updates delivered right to your inbox!

Thank you for your subscription