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

How to Add Custom Column in WooCommerce Admin Orders Page(Compatible with HPOS) ?

By default, the WooCommerce orders page showcases 7 columns: Order, Date, Status, Billing, Ship to, Total, and Actions. However, you can enhance this setup by integrating additional columns. For instance, you can add a dedicated column for product names. Adding custom columns in the WooCommerce Orders page makes the table more convenient without the need to navigate through endless order detail pages. Also, the code snippet will work fine if you have updated your site to the new HPOS order tables.

Solution: Add Custom Column in WooCommerce Admin Orders Page

This code snippet will help you add a custom column that displays product names as one of the columns in the WooCommerce Orders table. 

add_filter( 'manage_woocommerce_page_wc-orders_columns',
    function( $columns ) {

        // Add a custom column for product names
        $columns['product_names'] = __( 'Product Names', 'woocommerce' );

        return $columns;

}, 20 );

// Display Row Value
add_action( 'manage_woocommerce_page_wc-orders_custom_column',
    function( $column, $order_id ) {

        // Match Column
        if ( 'product_names' === $column ) {
            // Get the order object
            $order = wc_get_order( $order_id );

            // Get items from the order
            $items = $order->get_items();

            // Initialize an array to store product names
            $product_names = array();

            // Loop through items and get product names
            foreach ( $items as $item ) {
                $product_names[] = $item->get_name();

            // Display product names
            echo implode( ', ', $product_names );

}, 10, 2 );


The custom column labeled ‘Product Names’ is added and the product names associated with the corresponding order are fetched and displayed in that column to the WooCommerce Orders table.

How to Add Custom Column in WooCommerce Admin Orders Page(Compatible with HPOS) ? - Tyche Softwares

You can enhance this customization and tweak things even better by filtering WooCommerce orders by custom statuses, or product names as you wish. With filters, you can pull out specific details you need, like extra product info or customer data, right on the order details page.

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

Share It:

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x