This PHP code shows out of stock products for any specific user role set in the code. You can use the code with any of the default WordPress or WooCommerce user roles.
There’s also a code snippet included which creates a custom user role.
Note : The code only works when the user is logged in.
Copy and paste to the end of your child themes functions file or custom functionality plugin.