Please Help. wc subscriptions rest api change user role to subscriber
-
Hi.
I’m creating orders via rest-api for subscription products.
When the order is created and the user profile is created the default role is “customer”. Then the subscription is created and linked to the user profile but it doesn’t update the user role to “subscriber” in comparison to when the subscription is created purchasing via regular front end checkout.I contacted Prospress but the answer is not clear. This is what Bernat replied:
“By default, and as far as I see it, if you add a subscription to a customer using our REST API, the API should automatically update the role of the customer. If this is not happening, you can always update it programmatically using a workaround like this: https://wordpress.stackexchange.com/questions/4725/how-to-change-a-users-role.”
I think we are missing something here because i don’t see anywhere that this function “wcs_update_users_role( $user_id, $role_new )” responsible for updating or creating the new profile and set it as “subscriber” is called from the rest api class when creating a new subscription.
And the work-around has nothing to do with rest-api.
Can you please guide me where or how the user profile gets switched from “customer” to “subscriber” via rest-api.
Thanks
FC
- The topic ‘Please Help. wc subscriptions rest api change user role to subscriber’ is closed to new replies.