How to link two accounts in WooCommerce?

0

How to do this in WooCommerce?

Register a customer linked to the representative account, there everything the customer buys the representative can see. And with that the company will pay a commission to the rep.

So the rep will know everything the client is buying for him to receive his commission.

Is there any way to have this control?

    
asked by anonymous 03.11.2014 / 21:28

1 answer

1

It will be necessary to implement several functionalities to mount this system. And the beginning is exactly "linking user accounts".

Clients and representatives will have a separate role ( role ) , this can be managed manually via code or by using a specialized plugin . I'll show you here how to do this on the Users Profile page. The customer can choose his representative, and the representative can see which clients are associated with him. The logic of this may be different and the interface can be implemented in the frontend along with WooCommerce forms, but the functions to query / save user data will be the same (see Codex for definitions) p>

  • get_users()
  • get_user_meta()
  • update_user_meta()
  • current_user_can()
  • current_user_has_role() - this is a custom function created by me from references

In this example, I use the default roles, Subscriber equivalent to Client

04.11.2014 / 14:59