Hi @edelcambre
You might check out the stackoverflow link below to see if that helps.
https://stackoverflow.com/a/51752209
Hello, thank you for your response. Unfortunately I don’t think it is the same problem.
I don’t want to add a custom field, I want to change the way the customer is displayed in the “Customer” field : Customer User Meta (Customer ID – Customer email) instead of Customer first name Customer last name (Customer ID – Customer email), before and after the selection is made : https://snipboard.io/RsOF2W.jpg
There might be a filter for that ?
Thanks!
Hi @edelcambre,
I’ve performed some cross-testing on one of my test sites and was able to change the customer’s display from “First Name & Last Name” to “Display Name”.

Link to image: https://i.imgur.com/NnVXAoM.png
I clicked on “Profile” and changed the “Display name publicly as” to show the Display Name and updated the profile. Then I went back to check the order and it was updated with the Display Name.

Link to image: https://i.imgur.com/nAEkuan.png
If you’re not seeing the “Profile” link please update WooCommerce and temporarily deactivate all other plugins.
If you’re looking to set Display Name as default for all users, I’d recommend visiting this page and this Stack Exchange thread.
Hope this will work for you, if not, please consult with a developer who can help you create a custom solution – https://woocommerce.com/customizations/.
Thanks.
Hello, thank you for your answer, sorry I did not reply before. It results it makes no change on 2 of my websites… I will go on searching a solution
If someone is interested, I wrote this snippet that works for me :
add_filter('woocommerce_json_search_found_customers','my_found_customers') ;
function my_found_customers($found_customers) {
if(!empty($found_customers)) :
foreach($found_customers as $id => $found_customer) :
$customer = new WC_Customer($id);
$found_customers[$id] = preg_replace('/(.*?) \((.*?)\)/', $customer->get_display_name().' ($2)', $found_customer);
endforeach;
endif;
return $found_customers ;
}
Hi @edelcambre!
We are glad that you find a solution. Thank you for sharing it with everybody. 🙂
I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new one.
Cheers!
add_filter('woocommerce_json_search_found_customers','my_found_customers') ;
function my_found_customers($found_customers) {
if(!empty($found_customers)) :
foreach($found_customers as $id => $found_customer) :
$customer = new WC_Customer($id);
$found_customers[$id] = preg_replace('/(.*?) \((.*?)\)/', $customer->get_display_name().' ($2)', $found_customer);
endforeach;
endif;
return $found_customers ;
}
this solution is working for only searching users but if we check the old order display name still shows the first name, last name, id, and email so can we change that display name as well
`
Hi @vaibhavyuvasoft187
Thanks for posting your comment here.
However, since this thread is technically resolved, kindly create a new thread so that your issue can be looked at individually.
https://wordpress.org/support/plugin/woocommerce/#new-topic-0
This is in accordance with the forum guidelines on related posts.
Cheers