Title: Rest API
Last modified: August 31, 2022

---

# Rest API

 *  Resolved [alubis](https://wordpress.org/support/users/alubis/)
 * (@alubis)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/rest-api-138/)
 * Hello,
    I using this plugin and using 2 roles in customer role. But if I check
   using rest API woocommerce to get respon customer, I see only one role. I attached
   this screenshot on this bellow. on this wordpress menu user: [https://prnt.sc/JggYKZhtvfFp](https://prnt.sc/JggYKZhtvfFp)
   on this rest API: [https://prnt.sc/gogfLzbkldYq](https://prnt.sc/gogfLzbkldYq)
 * How to check using rest API to get 2 roles?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/rest-api-138/#post-15974525)
 * Hi [@alubis](https://wordpress.org/support/users/alubis/)
 * We checked this issue and from the second screenshot. That seems to be Woocommerce
   endpoint that only retrieve user primary role and not all user roles. Here is
   more technical details:
 * According to `LINE 173 OF WC_Customer_Data_Store` which has this code`'role' 
   => ! empty( $user_object->roles[0] ) ? $user_object->roles[0] : 'customer'`, 
   and as we can see, Woocommerce is intentionally adding primary role name only
   in the $customer object data.
 * Please note that we store multiple roles to the usermeta record in a standard
   way, but the Woocommerce code is currently designed to pull only the first role.
 * This issue literally belongs to Woocommerce and a support ticket can be raised
   with them to include multiple roles in $customer data and API endpoint data since
   by default, roles comes in form of array to signify support for multiple roles.
 * Hope that helps.
 * Thanks,
 *  Thread Starter [alubis](https://wordpress.org/support/users/alubis/)
 * (@alubis)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/rest-api-138/#post-16000365)
 * Helo Riza, thank you for the feedback

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Rest API’ is closed to new replies.

 * ![](https://ps.w.org/capability-manager-enhanced/assets/icon-256x256.png?rev=
   3408171)
 * [PublishPress Capabilities - User Role Editor, Access Permissions, User Capabilities, Admin Menus](https://wordpress.org/plugins/capability-manager-enhanced/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/capability-manager-enhanced/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/capability-manager-enhanced/)
 * [Active Topics](https://wordpress.org/support/plugin/capability-manager-enhanced/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/capability-manager-enhanced/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/capability-manager-enhanced/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [alubis](https://wordpress.org/support/users/alubis/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/rest-api-138/#post-16000365)
 * Status: resolved