Show Billing Company in Order List

This is for John Braithwaite who asked a question in a WooCommerce group on Facebook. He wanted to know how to display the Billing Company name in the Orders Page, since his customers are always companies and not individuals. So viewing by First Name and Last Name is not as important as being able to see the Company Name.

I did a little searching and found a filter that is used in the WC_Admin_List_Table_Orders class. It worked great but I found that the Orders List already looks for order that do not have any names in them and in those cases displays the Billing Company. So adding a check to see if the names are not empty solved the problem of the Billing Company being duplicated when being displayed.

Here’s the code snippet:

 * @snippet       Post View Count
 * @url 
 * @author        Dave Jesch
 * @date-written  Feb 28 2020
 * @donate $5

function d3j_filter_admin_buyer_name( $buyer, $order )
	// If there is no name, WC automatically shows just Billing Company. Let's not duplicate the Billing Company
	if ( ! empty( $order->get_billing_first_name() ) && ! empty( $order->get_billing_last_name() ) ) {
		$company = $order->get_billing_company();
		if ( ! empty( $company ) )
			$buyer .= ' - ' . $company;

	return $buyer;
add_filter( 'woocommerce_admin_order_buyer_name', 'd3j_filter_admin_buyer_name', 10, 2 );

This uses the ‘woocommerce_admin_order_buyer_name’ filter to modify the name being displayed on the Orders page within the admin. The code takes the filter value and adds the Billing Company name to the end of the name that is to be displayed.

Hopefully this helps John, or someone else who would like to have the same feature.

Leave a Reply

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