php - How do I know if the user is a customer?

admin2025-01-08  6

I'm using Woocommerce and Dokan latest version. I need to check if the user is a customer of that vendor. In this way, I will show the customer some information about that product or seller. First I thought of using localstorage but realized that there is no product-specific assignment. So I think this method won't work.

So how can I know this and take action accordingly?

I'm using Woocommerce and Dokan latest version. I need to check if the user is a customer of that vendor. In this way, I will show the customer some information about that product or seller. First I thought of using localstorage but realized that there is no product-specific assignment. So I think this method won't work.

So how can I know this and take action accordingly?

Share Improve this question asked Jun 14, 2021 at 10:08 folec94folec94 1 1
  • How does WooCommerce store the relationship between customers and vendors? Would you have to look through your current users's order history to get a list of vendors that they are customers of? (If you do, I'd cache that in a transient, and make sure you clear it / update it on a new order.) But I think you probably want to do this on the server side, not the client side, unless you're assembling the page by AJAX? (I don't know Dokan) – Rup Commented Jun 14, 2021 at 13:18
Add a comment  | 

1 Answer 1

Reset to default 0

WordPress have role and permission system, WordPress have following built-in roles

1 Admin privilege's 10. 2 Editor 3 Author 4 Subscriber

The Subscriber is consider as client, i mean users, you can made check on this.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736266521a1127.html

最新回复(0)