Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Add a WooCommerce Orders List Column

July 18, 2017

2 Min Read
Reading Time: 2 minutes

Every WooCommerce Orders list has columns that highlight various details about the order. While these columns could be easily remove through the Screen Options tab, the addition of the columns requires custom code that adds a column to the list.

WooCommerce Order Column

Add a Header

The addition of a custom columns is done through manage_edit-{$post_type}_columns filter (part of the WordPress core). By using this filter, I could change the columns in the list table  and inject my own column(s).

function wc_new_order_column( $columns ) {
$columns['my_column'] = 'My column';
return $columns;
add_filter( 'manage_edit-shop_order_columns', 'wc_new_order_column' );

Now I am going to add a column in my intended position.  This would be a new Profit column that would come after the total column for the order.

function cw_add_order_profit_column_header($columns)
    $new_columns = array();
    foreach ($columns as $column_name => $column_info) {
        $new_columns[$column_name] = $column_info;
        if ('order_total' === $column_name) {
            $new_columns['order_profit'] = __('Profit', 'my-textdomain');
    return $new_columns;

add_filter('manage_edit-shop_order_columns', 'cw_add_order_profit_column_header');

Now we can use that to get the profit for the order and add it to the column.

function cw_add_order_profit_column_content( $column ) {
    global $post;

    if ( 'order_profit' === $column ) {

        $order    = wc_get_order( $post->ID );
        $currency = is_callable( array( $order, 'get_currency' ) ) ? $order->get_currency() : $order->order_currency;
        $profit   = '';
        $cost     = sv_helper_get_order_meta( $order, '_wc_cog_order_total_cost' );
        $total    = (float) $order->get_total();

               if ( '' !== $cost || false !== $cost ) {

            $cost   = (float) $cost;
            $profit = $total - $cost;

        echo wc_price( $profit, array( 'currency' => $currency ) );
add_action( 'manage_shop_order_posts_custom_column', 'cw_add_order_profit_column_content' );

Now, the following is optional. I will make the Profit column the same width as the total column. I will add custom CSS to the existing stylesheet by using the function wp_add_inline_style. I will add this to woocommerce_admin_styles:

function cw_add_order_profit_column_style() {

    $css = '.widefat .column-order_date, .widefat .column-order_profit { width: 9%; }';
    wp_add_inline_style( 'woocommerce_admin_styles', $css );
add_action( 'admin_print_styles', 'cw_add_order_profit_column_style' );

Adding custom columns to WooCommerce order list is a matter of adding code through a filter. If you need help with the code and the process of adding the custom columns, do leave a comment below and I will get back to you ASAP.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Your WooCommerce Store Needs A Reliable Host

With no compromise on Performance, Security & Support.

Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

BFCM 2019