I am creating a WooCommerce Plugin so admin can placed an order on behalf of a customer. This plugin is useful for those websites who have regular/recurring customers who placed orders on Phone & WhatsApp.

function display_customers_list() {
// query array
$args = array(
    'role' => 'customer'
$customers = get_users($args);
if( empty($customers) )
echo'<h3>Display Customer List</h3>';
foreach( $customers as $customer ){
    echo '<option value="'.$customer->data->user_login.'">'.$customer->data->display_name.'</option>';


add_filter( 'woocommerce_checkout_fields' , 'display_customers_list');

By using above code I get the list of registered "customers".


My question if how can I fetch the details of selected customer i.e

  1. Billing First Name
  2. Billing Phone
  3. Billing Email


I want when admin Select the Customer from list then details of that specific customer can auto placed in Woocommerce order form in respective fields.

Please help.

  • You could fetch the data with an ajax call. You bind some JavaScript code on your cstomer select tag and then if you change the customer, it sends the customer id to the server. With the id you call the database and get the customer data. Then you send this data back to your JavaScript code and then write the data to the form. – user141080 Jul 20 '18 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.