• Resolved renatofrota

    (@renatofrota)


    Hello,

    I have WooCommerce enabled in 2 subsites of a WPMS install.

    User [email protected] have “Customer” role in StoreA subsite (registered and made a purchase there)

    User [email protected] is not a customer in StoreB subsite (nor have any role there).

    User [email protected]:

    1. is not able to purchase as a guest at StoreB (“a customer is already registered with this e-mail, login first”).
    2. is not able to register at StoreB (“this e-mail is already in use”)
    3. is not able to request a password recovery at StoreB (“user not found”)
    4. is able to login (if he was lucky enough to “remember” the e-mail/login and password combination – since he actually registered to StoreA – and there’s no visible information on these stores informing they are related one to other)
    5. is able to make a purchase at StoreB after logged in (although he have no user role at StoreB)
    6. still have no role at StoreB after checkout
    7. StoreB owner have access to order/customer details in Orders, but can’t see the customer under ‘Users’ Dashboard section

    I would like to improve the items 3 and 4.

    • For item 3: allow the user to request a password recovery at StoreB, and when it happens, automatically assign him the Customer role at StoreB;
    • For item 4: assign him the Customer role at StoreB

    Is there a way to accomplish this with a code snippet or plugin? Or how can I suggest these changes to be added to roadmap?

    Thanks

    https://www.ads-software.com/plugins/woocommerce/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    User handling across multisite is not WooCommerce specific. WordPress itself handles accounts, we just change the role.

    I’d suggest researching some generic WP solutions such as https://www.ads-software.com/plugins/multisite-user-sync/

    Thread Starter renatofrota

    (@renatofrota)

    Hello, Mike

    Thanks for your reply.

    However, this is not something I would really want to have (all customers synced). I would like to have only customers who perform steps 3 / 4 (those who request a password recovery and those who do login directly at StoreB) to be added a role on it.

    Actually, if I can do it on login for 4. (on login at StoreB, if user do not exists on StoreB user list (have no role), check if customer exists as a network, and if so, give him Customer role on StoreB and allow login) it would solve 90% of my problems for now.

    For the password recovery, I think of providing more instructions on “no user found” lang string when the email lookup fail for a visitor, pointing him to a page explaining the user base is shared – and perhaps I can create a plugin where visitor input his email and we show all websites his data is shared (only those where he have a role and is viewable by the subsite’s admins) ??

    I will come back with updates if I have any progress.

    Thanks!

    Thread Starter renatofrota

    (@renatofrota)

    Hello, again

    Item 6 (an user still have no role after checkout);

    Isn’t this considered a good feature request? Shouldn’t an user that have no role have Customer role added after a successful checkout at a given subsite?

    Thread Starter renatofrota

    (@renatofrota)

    Sorry for the ‘flood’, I can’t edit previous replies.

    Just a complimentary information.

    For WooCommerce, the item 6 is more important than item 4. I understood the item 4 is “Multisite related”, not WooCommerce specific. Some subsites are not WooCommerce stores but do still allow customer logins for other reasons (they have a profile and some data stored, etc) and I understand I would need to fix it at network-level or by adjusting the other plugins that require a role for user to be more “network aware”, if it’s required for me.

    But the item 6 involves the checkout process, so it would be an WooCommerce feature, not a general WP user handling behavior. For me it doesn’t make sense an user place an order and the store admin/manager do not see the customer on store’s user list.

    Thanks.

    Thread Starter renatofrota

    (@renatofrota)

    Hello (again!)

    Actually… there’s another problem on all this, right at start, item 1.

    If a guest try a checkout using an e-mail address that already exists on database, if this e-mail do not have any role at StoreB, can’t the order be allowed and customer given the “Customer” role? ( 100% WooCommerce specific, in this case ?? )

    Thread Starter renatofrota

    (@renatofrota)

    ^ my bad on this. The reason for not allowing guest checkout with any e-mail that already exists on the database is pretty obvious (anybody would be able to checkout using an existing user e-mail address – on purpose on mistakenly – without user knowledge/authorization).

    So my issues are indeed in items 3/4/6. Fixing item 3 I believe is my main concern at this time – but adding Customer role to the an user who directly login at StoreB can be considered – and I understand items 3 and 4 are non-WooCommerce specific. However, item 6 is. Waiting your thoughts on this ??

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    R/e #6, forcing customer role after checkout is not desirable. Messing with existing roles could break other aspects of your site. What if an admin used the checkout!!? Thats why role is only set for new users.

    Thread Starter renatofrota

    (@renatofrota)

    Hello, Mike.

    I understand your point. However, I suggested it to happen only for cases where the user do not have any role on the website yet.

    If an user have no role, once he makes a purchase, he becomes a Customer. Makes sense?

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Not really; if they are registered on the site, they already have a role.

    Thread Starter renatofrota

    (@renatofrota)

    Mike,

    It seems the excess of information on this thread made it more confuse to understand. Please consider this a new case from this point on.

    1- visitor (John) access StoreA, buy something (and register). John is now a user on Network and have Customer role on StoreA.
    2- John access StoreB days after – he’s is automatically logged in because the Network has cross-login cookies – and buy something.

    StoreA owner can see John in StoreA user list
    StoreB owner can’t see John in StoreB user list

    Is it more clear now?

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I don’t think cross-site cookies is standard is it?

    There is an action hook here:

    https://github.com/woothemes/woocommerce/blob/master/includes/class-wc-checkout.php#L588

    Perhaps if you can access the user ID (not sure if it would be exposed given that setup) you could call https://codex.www.ads-software.com/Function_Reference/add_user_to_blog

    Thread Starter renatofrota

    (@renatofrota)

    Hello, Mike

    Yes, cross-site login is currently pretty standard on WordPress Multisite(!).

    I have tested it by setting up a network, installed and activated only WooCommerce plugin for 2 subsites and I replicated the steps 1 and 2 as described above.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Yes, cross-site login is currently pretty standard on WordPress Multisite(!).

    I know it is for admin, but I’m not clear how it would work for a member of one blog only. If you can access the user ID on a site you’re not a member of (the case you described above) it will be possible to add a workaround via the action hook, and could possibly be included in core if it works without issue. Have you attempted this yet?

    Thread Starter renatofrota

    (@renatofrota)

    Hello, Mike

    The cross-site login works for any user, no matter the role (or the lack of them).

    I will try dealing with the action hook and will let you know if I have any progress.

    Thanks!

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘How to automatically "import" customers from other subsites?’ is closed to new replies.