Completely hide products from unauthorized users in WooCommerce
I'm trying to remove a product/products completely from Users that are not logged in and if user is not specific role (e.g Verified Buyer). I have been able to create a new role called Verified Buyer using the code below; add_role( 'verified_buyer', __( 'Verified Buyer', 'text-domain' ), array( 'read' => true, 'edit_posts' => false, ) ); //This Role is same role capability as the WooCommerce Customer role and i have as well added a checkbox to the WooCommerce Add New Product page using the code below function hide_product_from_unathorised_users() { $args = array( 'id' => '_hide_from