0

I am making a plugin so an admin can submit an order on behalf of a customer in Woocommerce. This plugin is suitable for orders placed via phone/email/WhatsApp.

I want to display a list of customer as dropdown in the WooCommerce checkout Page. Only administrators can see this list.

Please help.

  • WooCommerce admins can already create orders for customers in the back-end, can't they? – Jacob Peattie Jul 19 '18 at 7:36
  • @JacobPeattie yes dear. But I want this in front-end. In this question I just want to display a list of customer as dropdown in WooCommerce Checkout Page. Only Administrate Role can see this list. – Amina Ahmad Jul 19 '18 at 7:38
0

Woocommerce customers are just regular WordPress users, so you can use the standard get_users() function.

You can pass the argument role to that, so something like...

$customers = get_users( 'role=customer' );

|improve this answer|||||
-1

I get it using this code

$args = array(
    'role' => 'dealer1'
);
$users = get_users($args);
if( empty($users) )
  return;
|improve this answer|||||
  • Please edit your answer, and add an explanation: why could that solve the problem? – fuxia Jul 20 '18 at 15:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.