Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Add Customer Order Count to WooCommerce Admin Orders List (Compatible with HPOS)?

By default, WooCommerce’s admin orders list provides essential order details but doesn’t offer quick insights into a customer’s purchase history. For store owners who want to track repeat buyers or analyze loyalty, this can be limiting.

With a simple code snippet, you can add a custom “Order Count” column to the WooCommerce admin orders dashboard, showing the total number of orders placed by each registered customer.

Solution: Add Customer Order Count to WooCommerce Admin Orders List

The snippet below adds a new column called “Order Count” to your WooCommerce admin orders list. For each order, it shows the total number of orders placed by that customer. The code is fully compatible with HPOS (High-Performance Order Storage).

// Add new custom column to WooCommerce Admin Orders list (HPOS compatible)
add_filter( 'manage_woocommerce_page_wc-orders_columns', 'ts_add_wc_order_list_custom_column' );
function ts_add_wc_order_list_custom_column( $columns ) {
    $reordered_columns = array();

    // Insert the column after the "Status" column
    foreach( $columns as $key => $column ) {
        $reordered_columns[$key] = $column;

        if ( $key === 'order_status' ) {
            $reordered_columns['order-count'] = __( 'Order Count', 'woocommerce' );
        }
    }

    return $reordered_columns;
}

// Display customer order count in the new column
add_action( 'manage_woocommerce_page_wc-orders_custom_column', 'ts_display_wc_order_list_custom_column_content', 10, 2 );
function ts_display_wc_order_list_custom_column_content( $column, $order ) {
    if ( $column === 'order-count' ) {
        $user_id = $order->get_user_id();

        if ( $user_id ) {
            echo wc_get_customer_order_count( $user_id ); // Display total orders
        } else {
            echo '<small>(Guest)</small>';
        }
    }
}

Output

After implementing this snippet, when you visit the WooCommerce Orders page, you will see a new column named “Order Count.” This column displays the total number of orders each customer has placed.

Customer Order Count to WooCommerce Admin Orders List

While knowing the total number of orders is helpful, sometimes you need more direct information about your customers, like their email or phone number, right from the orders page. For those cases, you can also add customer phone and email columns directly to your WooCommerce order IDs. This allows you to contact your buyers quickly or cross-check their details without opening each order individually.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Leave a Reply

Your email address will not be published. Required fields are marked *

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.