Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @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

    (@alubis)

    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.