Search code examples
phpwordpresswoocommerceuser-roles

All customers in Woocommerce are listed as role "none"


I was trying to echo a list of all users in woocommerce site. it worked with "role=subscriber", but it didn't work with "customer".

when I checked the admin, I saw all customers are listed as "none" in the role column.

How can I change the role for all of this users?

Capture from the admin panel:

If it helps: I have "user role editor" plugin installed on this site


Solution

  • It looks like the page could not load the users meta data, which is understandable when talking about this amount of users (i'm guesting on hosted server with custom fields).

    this could be a php memory_limit problem, you can add:

    ini_set('memory_limit', '-1');
    

    at the beginning of the /wp-admin/users.php page. if it's not working try to create a simple php file that contains the following code:

    <?php
    error_reporting(E_ALL);
     ini_set('display_errors', 1);
    
    get_users();//or with 'role=customers' 
    ?>
    

    So you can see the actual error from the function.