Change WordPress user roles and capabilities › Forums › New Feature Request › How can i hide woocommerce orders based on role? › Reply To: How can i hide woocommerce orders based on role?
28/09/2021 at 01:50
#7702
Vladimir
Keymaster
Answering on your question at Stackoverflow:
WooCommerce order is a custom post type ‘shop_order’. Its main record is stored at wp_posts database table (‘wp_’ is db prefix). This record does not store the information about user role. It has field ‘post_author’, which contains user ID, under which this order was created. In order to find a role you need to load user by ID using get_user_by(), and check role(s) of that user.