user10403192
user10403192

Reputation:

Add customer email and phone in "Order" column to admin orders list on Woocommerce

I am trying to find a way on how to add the customer phone and email below the name on the WooCommerce order view. See picture for reference where I need to add this information.

Any ideas, tips or pointers on how to make this happen? enter image description here

Upvotes: 3

Views: 3173

Answers (2)

user3711251
user3711251

Reputation: 1

Thank you, worked perfectly. I had modifed based on my need, adding the code here for others.

add_action( 'manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 50, 2 );
function custom_orders_list_column_content( $column, $post_id ) {
    if ( $column == 'order_number' )
    {
        global $the_order;

        if( $phone = $the_order->get_billing_phone() ){
            $phone_wp_dashicon = '<span class="dashicons dashicons-phone"></span> ';
            echo '<br>Mobile: '.'<a href="tel:'.$phone.'">' . $phone.'</a></strong>';
        }

        if( $email = $the_order->get_billing_email() ){
            echo '<br>Email: '.'<a href="mailto:'.$email.'">' . $email . '</a>';
        }
    }
}

Upvotes: 0

LoicTheAztec
LoicTheAztec

Reputation: 253738

The following code will add the billing phone and email under the order number in backend orders list (for Woocommerce 3.3+ only):

add_action( 'manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 50, 2 );
function custom_orders_list_column_content( $column, $post_id ) {
    if ( $column == 'order_number' )
    {
        global $the_order;

        if( $phone = $the_order->get_billing_phone() ){
            $phone_wp_dashicon = '<span class="dashicons dashicons-phone"></span> ';
            echo '<br><a href="tel:'.$phone.'">' . $phone_wp_dashicon . $phone.'</a></strong>';
        }

        if( $email = $the_order->get_billing_email() ){
            echo '<br><strong><a href="mailto:'.$email.'">' . $email . '</a></strong>';
        }
    }
}

Code goes in function.php file of your active child theme (active theme). Tested and works.

enter image description here

Upvotes: 5

Related Questions