Display WooCommerce Order Customer Username on Edit Order Page

When viewing or editing a WooCommerce order, it can be pretty handy to add custom data to the page to avoid having to switch between pages. Today, i’ll provide a quick snippet that will add to the edit/view order page the customer username and a link to its user profile.

The result in action:

add-customer-username-to-order

Pretty handy right?

So, to add this feature to your site, simply place the following snippet in the functions.php file within your theme folder and you’re done!

5 responses to “Display WooCommerce Order Customer Username on Edit Order Page”

  1. douglsmith

    Thanks, Remi.

    I’ve always thought that should be built into the order screen somewhere, e.g., as an icon near the existing customer drop down menu or something.

    This makes a great, simple solution that is very helpful. I added a condition to make sure $customer_user isn’t zero to skip the output for guest customers.

    1. Thanks Doug. Yeah I provided the basic code (as always), so it can (must?) be improved! ;-)

    2. dragnfly

      Thanks Remi, works great and very handy.

      @douglsmith > Do you mind sharing how you added the condition.

  2. clvanos

    Nice feature Remi!

    We are working with different customer roles. Do you know how to display the user role of the customer instead of the username?

  3. alexanderbiscajin

    Hi Remi, thank you for sharing this great article. Can you guide me how to display the WooCommerce customer order information as i have tried several forums and also gone through a tutorial https://www.wpblog.com/display-woocommerce-customer-order-details/ there i have been stuck in the code while implementing.

    add_action( ‘woocommerce_admin_order_data_after_billing_address’, ‘blog_anothermethod_display’);
    function blog_anothermethod_display( $order ){
    $order_id =43;
    $order_meta = get_post_meta($order_id);
    print(“”);
    print_r($order_meta);
    print(“”);
    }

Leave a Reply