Created
July 9, 2024 11:08
-
-
Save shameemreza/a3658a9bfb7d6c32d2db13dd6d8388bb to your computer and use it in GitHub Desktop.
Show company instead of name in the orders list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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