This use-case is a demonstration of hiding categories for Guest User.
Observe that only Clothing and it’s sub Categories are shown for users who are not logged In (Guest Users). This use case is achieved by creating a Logical Rule using Guest User and using this Logical Rule while defining the Category Rule. See below screenshots for more info.
Products from hidden categories will be excluded from search. Enter album in product search and check for album products. No products will be displayed.
Now login with krish user with below credentials, observe that music and posters categories are shown. Now search for album you can observe that products are displayed.
User Name : krish
Role : Author
Below screenshot shows the Logical Rule define for Guest User.
Below screenshot shows the Category Rule define for Guest User.
Similarly we can hide WooCommerce categories based on Country, City, Region, Device, Page, Post and dates. You can play with WooCommerce categories they way you want.