Activate “Content View Access Restrictions” module at User Role Editor Settings page:
Post level restrictions
Starting from version 4.10 you may restrict view access for posts and page on the user roles base. If you wish to restrict the post views by members of the selected roles only follow these steps:
1) Open the post for edit, scroll to “Content View Restrictions” metabox.
2) Select the access restriction action. Two options are available: “Prohibit” or “Allow”.
3) Click “Edit Roles List” button and select role(s) for which you wish to apply access restriction action. Click “Save” button, check that roles list at the readonly textarea was updated.
Do not forget to click “Update” button to save full changes made to the post including roles list you just built.
That’s done. This post is available for logged-in users only. If you selected action “Prohibit”, that this post is available for the all roles except included into roles list. If you selected action “Allow”, that this post is available only for the roles included into roles list.
The example of using this feature with WooCommerce products and categories:
Role level restrictions
Starting from version 4.19 it’s possible to set posts/pages view restrictions for the selected role:
Select role and click “Posts View” button:
At opened dialog select/input appropriate access restrictions options: