WooCommerce: Add Column to Orders Table @ WP Dashboard

The WooCommerce Orders Table, which can be found under WP Dashboard > WooCommerce > Orders, provides us with 7 default columns: Order – Date – Status – Billing – Ship to – Total – Actions. This is used by shop managers to have an overview of all orders, before eventually clicking on a specific one.

So the question is: how can we display additional columns to that same orders table, so that we can immediately visualize an order custom field, a specific product contained in the order, or anything order-related that can be “calculated” once we have access to the $order variable?

Display an additional columns in the Orders Table @ WooCommerce Dashboard

PHP Snippet: Display Custom Column @ WooCommerce Admin Orders Table


/**
 * @snippet       Add Column to Orders Table (e.g. Billing Country) - WooCommerce
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=78723
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.4.5
 */

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

function bbloomer_add_new_order_admin_list_column( $columns ) {
    $columns['billing_country'] = 'Country';
    return $columns;
}

add_action( 'manage_shop_order_posts_custom_column', 'bbloomer_add_new_order_admin_list_column_content' );

function bbloomer_add_new_order_admin_list_column_content( $column ) {
  
    global $post;

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

        $order = wc_get_order( $post->ID );
        echo $order->get_billing_country();
	  
    }
}

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7+.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce Customization?

Check out these free video tutorials!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

16 thoughts on “WooCommerce: Add Column to Orders Table @ WP Dashboard

  1. Hi Rodolfo,

    Thanks for the tutorial. I have almost the same question as Carole asked in 2018. Is that possible to show all the photos for ordered items include variations (if exist) and how to make it happen? I tried different ways and just can’t make it work.

    Thanks a lot!

    1. Hello Leon, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  2. Hi
    is it possible to change the column title?

    1. Hey Somy, yes, it is inside the function bbloomer_add_new_order_admin_list_column()

  3. Hi,

    I have some custom checkout fields I would like to show as columns, how do I need to change your code to work for my use case?

    I tired it as it is but only seems to work for standard checkout fields like country, state, first name, etc.

    Btw, thank you for the snippet 🙂

    1. Hello there, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  4. Hi Rodolfo,
    Perfect, I added my code for get_total_tax(). It’s helpful for to do my accounting (with Dougs), not oblige to open each order for check if I must indicate if it’s taxed or not. But right now I’ve no idea how to add the Stripe fee in a column. I’m going to see that later. Unless you have an idea 🙂
    Thanks a lot again for your tips.
    Rémi from France.

    1. Excellent! I’m sure you’ll figure out the Stripe thing as well 🙂

  5. Hi Rodolfo,
    This is again a great article, One of my friends is using this method. It really helps them.

    1. Cool 🙂

  6. Hi Rodolfo,

    Thanks for yet another great Woo snippet! Can this be used to display which coupon code was used for each order, if any?

    Thanks!
    -Steve

    1. Hey Steve – thanks so much for your comment! Positive, the get_used_coupons() function should help 🙂

  7. Could I add a column for the product photo?

    1. Hello Carole – thanks so much for your comment! Of course – as long as orders have max 1 product or if you just want to show the first product 🙂

  8. Greetings Rodolfo !
    Thanks for your tips !
    I’m going to try it this week. That will be helpful for me, I wish to see Tax, Stripe fee,.. for to do my accounting without open each order. I will se if I can with your tips.
    (However, maybe I can do that by export all order in a xls table)
    Thanks
    Rémi

    1. Rémi – thanks so much for your comment! Good luck 🙂

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.