Created
April 8, 2025 13:28
-
-
Save webdados/2ee182178812bc18b54df3f97086c185 to your computer and use it in GitHub Desktop.
Change the label for the autocomplete user results no the Shop as Client for WooCommerce plugin
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
<?php | |
add_filter( | |
'shop_as_client_autocomplete_user_label', | |
function ( $label, $user_id, $display_name, $user_email ) { | |
// Get the user | |
$user = get_user( $user_id ); | |
$name_to_display = html_entity_decode( $user->display_name, ENT_QUOTES, 'UTF-8' ); | |
// Use same label but with $name_to_display as the name | |
return sprintf( | |
__( 'Cust. #%1$d: %2$s - %3$s', 'shop-as-client-pro' ), | |
$user_id, | |
$name_to_display, | |
$user_email | |
); | |
}, | |
10, | |
4 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment