Restrict WooCommerce products to logged-in users

Do you need to restrict WooCommerce products to logged-in users?

By default, WooCommerce doesn’t fully lock down product visibility.

Even if you remove something from a shop page, it can still show up in search results or category archives.

In some cases, users can even land directly on a product page through an old link or search engine result.

That creates an inconsistent experience and can expose products you intended to keep private.

A better way to handle this is by controlling product visibility based on user roles, including guests (non-logged-in visitors).

This is exactly why I developed Hide Products by User Role for WooCommerce.

Instead of just hiding products visually, the plugin filters them at the query level.

That means hidden products are never actually loaded into shop pages, search results, or archives in the first place.

Installing the plugin

The installation process is the same as most WordPress plugins, so nothing complicated here.

You start from your WordPress dashboard, go to Plugins → Add New, and search for the plugin by name ‘Hide Products by User Role for WooCommerce‘.

Once you find it, you install and activate it like any other plugin.

After activation, WooCommerce will automatically gain a new settings area for visibility rules.

You don’t need to modify theme files or write custom functions, everything is handled through the admin interface.

Global visibility rules

Once the plugin is active, go to:

WooCommerce → Settings → Products → Hide by User Roles

This is where global visibility rules are managed.

It’s the control center for deciding who can see what in your store.

Creating a rule to exclude guests

To restrict your entire catalog from guest users, you’ll create a global rule.

Inside the rules panel, click Add Rule, then set it up like this:

Choose the user role Guest.

Then select the scope of the rule. In this case, simply choose All Products.

Save.

Once saved, this rule immediately applies across the entire store.

From that point on, guests will no longer see products in shop pages, categories, or search results.

Even if they try to access a product directly, they won’t be able to bypass the restriction and they will be redirected to the login page.

Once they log in, everything works normally again based on their assigned role.

Restrict product categories to logged-in users

Once you’ve set up a basic “guest exclusion” rule, the next step many store owners take is controlling visibility at the category level.

This is useful when you don’t want to lock the entire store, but still need certain parts of it available only to logged-in users.

With Hide Products by User Role for WooCommerce, this is handled through global rules, without touching code or templates in WooCommerce.

To set it up, you go to WooCommerce → Settings → Products → Hide by User Roles, the same place used for global visibility rules.

From there, you add a new rule and choose the user role Guest.

Instead of selecting “All Products,” you switch the rule type to Product Category.

Restrict product tags to logged-in users

Maybe you need to control visibility at the tag level.

To set it up, you go to WooCommerce → Settings → Products → Hide by User Roles, the same place used for global visibility rules.

From there, you add a new rule and choose the user role Guest.

Select Product Tag as target.

Now you can pick specific tags that should not be visible to visitors who aren’t logged in.

Restrict single product to logged-in users

Sometimes you don’t need to hide an entire catalog or even a whole category.

You just want one specific product to be visible only to logged-in users.

To do it, you simply open the product you want to restrict from the WordPress admin area, just like when editing any normal product.

Scroll down to the Product Data section, where you’ll find a tab called Hide by Role.

Inside that tab, you can select which user roles should not see this product.

If your goal is to restrict it to logged-in users only, you would typically select the Guest role.

Once you save the product, the restriction is applied immediately across the entire store.

Restrict Product Variations for Logged-in Users

In some stores, it’s not the entire product that needs restriction, it’s specific variations.

Think about sizes, colors, bundles, or premium versions of a product that should only be visible to logged-in users or certain customer roles.

With Hide Products by User Role for WooCommerce, you can control this directly inside the variation settings in WooCommerce.

To set it up, you go to the WordPress admin and edit a variable product as usual. Inside the Product Data panel, open the Variations tab.

From there, expand the specific variation you want to restrict.

Once the variation settings are open, you’ll see an option called Hide this variation for.

This is where you choose which user roles should not be able to see it.

If your goal is to make it available only to logged-in users, you simply select the Guest role.

After saving the product, that variation is immediately removed for guests across the entire store.

More posts