• Resolved frnkoc

    (@frnkoc)


    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there @frnkoc,

    This is quite a complex development question, and quite closely tied to the Subscriptions plugin – it’s very possible that no-one here will have the specific knowledge to help you out. You’d be best off following up with the Prospress developers directly.

    I’ll leave this thread open for a bit to see if anyone can chime in!

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there @frnkoc,

    I checked in with the Prospress team for you. They replied with more information on 8 June and haven’t heard back from you since. If you aren’t able to find their reply, I’d follow up with them again – they’d still like to investigate further.

    I’m going to mark this thread as resolved, as it’s something that’ll be handled further by the Prospress team.

    Thread Starter frnkoc

    (@frnkoc)

    Hi Hannah.

    I’ve got the reply from Prospress. They correctly described the process that happens if you purchase using the front end checkout.

    Their response was:
    ‘Subscriptions updates the customer role to Subscriber when it registers that the subscription is in Active status. Only customers with subscriptions in Active status will register with the Subscriber role. “status”: “active”‘

    But creating or updating a subscription via rest-api to “active” status doesn’t update or change the user role from “customer” to “subscriber”.

    i will continue the commmunication by email with Prospress.
    Thanks for looking into this issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Please Help. wc subscriptions rest api change user role to subscriber’ is closed to new replies.