How to add customer email and phone in Order column to admin orders list on Woocommerce


Sometimes a store manager finds a bit difficult to find customer’s contact information from the order details of WooCommerce as he has to click several times to reach there. To make them easy to find customer’s contact information, we can add the customer’s email address and phone in the orders table and under orders column to the admin orders list on WooCommerce.

For example, the following screenshot shows customer’s contact details in the Order column to the admin orders list:

The store manager can see the customer’s contact information directly with the order, under the Order column. To add that feature, add the following code in the functions.php of your child theme:

// add customer email and phone to order in backend - order management
function w3p_customer_information_order_column( $column, $post_id ) {
    if ( $column == 'order_number' ){
        global $the_order;

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

        if( $customer_email = $the_order->get_billing_email() ){
            echo '<p><a href="mailto:'.$customer_email.'"><span class="dashicons dashicons-email"></span> '.$customer_email.'</a></strong></p>';

add_action( 'manage_shop_order_posts_custom_column' , 'w3p_customer_information_order_column', 50, 2 );

Note: Don’t forget to check the opening and closing tags of PHP.

Related Posts