Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shameemreza/a3658a9bfb7d6c32d2db13dd6d8388bb to your computer and use it in GitHub Desktop.
Save shameemreza/a3658a9bfb7d6c32d2db13dd6d8388bb to your computer and use it in GitHub Desktop.
Show company instead of name in the orders list
// Show company instead of name in the orders list
add_filter( 'woocommerce_admin_order_buyer_name', function( string $buyer, WC_Order $order ): string {
$company = trim( $order->get_billing_company() );
if ( empty( $company ) ) {
return $buyer;
} else {
return $company;
}
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment