Site icon Experience Wordpress Developer Online – Design Develop and Maintenance Support

Add Column to Orders Table at WordPress Dashboard

In WooCommerce order table, which found in WordPress dashboard> WooCommerce>Orders. You can see order,date,status and total column. It provide by WooCommerce. It’s default column. If you want to add other column in this list, here is solution. In this example i will add “Country” column in order list.

Add below line of code in your theme’s functions.php file of your active child theme (or theme) and save the file.

add_filter( 'manage_edit-shop_order_columns', 'add_new_order_column_admin' );
 
function add_new_order_column_admin( $columns ) {
    $columns['billing_country'] = 'Country';
    return $columns;
}
 
add_action( 'manage_shop_order_posts_custom_column', 'add_new_order_column_content_admin' );
 
function add_new_order_column_content_admin( $column ) {
   
    global $post;
 
    if ( 'billing_country' === $column ) {
 
        $order = wc_get_order( $post->ID );
        echo $order->get_billing_country();
       
    }
}
Exit mobile version