Title: Hide Products by User Role for WooCommerce
Author: robertoiacono
Published: <strong>2025 年 11 月 6 日</strong>
Last modified: 2026 年 6 月 16 日

---

搜索插件

![](https://ps.w.org/riaco-hide-products-by-user-role/assets/banner-772x250.png?
rev=3567851)

![](https://ps.w.org/riaco-hide-products-by-user-role/assets/icon-256x256.png?rev
=3565957)

# Hide Products by User Role for WooCommerce

 作者：[robertoiacono](https://profiles.wordpress.org/prototipo88/)

[下载](https://downloads.wordpress.org/plugin/riaco-hide-products-by-user-role.1.1.1.zip)

 * [详情](https://cn.wordpress.org/plugins/riaco-hide-products-by-user-role/#description)
 * [评价](https://cn.wordpress.org/plugins/riaco-hide-products-by-user-role/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/riaco-hide-products-by-user-role/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/riaco-hide-products-by-user-role/#developers)

 [支持](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/)

## 描述

**Hide Products by User Role for WooCommerce** gives store owners complete control
over product visibility based on WordPress user roles — including guests (unauthenticated
visitors). Set global rules from the WooCommerce settings screen, or configure visibility
per product and per variation, all without writing a line of code.

[Live demo](https://playground.wordpress.net/?plugin=woocommerce&plugin=riaco-hide-products-by-user-role)

Whether you run a B2B wholesale store, a membership site, or simply want to keep
certain products away from guests, this plugin enforces visibility at the query 
level so hidden products never leak through search, archives, the REST API, or direct
URL access.

### Why store owners choose this plugin

 * **Run B2B and B2C from a single store** — keep wholesale and retail catalogs 
   side by side and show each audience only what they should see
 * **Protect member-only or exclusive products** — restrict visibility to subscribers,
   members, or any custom role
 * **Increase catalog relevance** — show each user role a curated product set and
   reduce catalog noise
 * **Block guest browsing** — require an account before any product is visible, 
   turning your shop into a private catalog
 * **Zero performance overhead** — visibility is enforced at the WordPress/WooCommerce
   query level, not as post-load filtering

### Key Features

**Global visibility rules (WooCommerce > Settings > Products > Hide by User Roles)**

 * Hide **all products** from a role with a single rule
 * Hide products by **category** or **tag** per role
 * Unlimited rules with drag-and-drop **priority ordering**
 * **Duplicate** existing rules to create variations quickly
 * Rule-count badge in the WooCommerce settings navigation

**Per-product and per-variation control**

 * Dedicated **“Hide by Role”** tab on every WooCommerce product edit screen
 * Select any combination of roles to hide that individual product from
 * Full support for **variable products**: set visibility separately on each variation

**Complete query coverage — hidden means truly hidden**

 * Shop page, category archives, and tag archives
 * WordPress and WooCommerce **search results**
 * **FiboSearch** (DGWT WooCommerce Ajax Search) compatibility
 * **WooCommerce REST API** (with block-editor edit-context exemption so admins 
   can still select products)
 * **Single product page redirect** — guests are sent to the login page; logged-
   in restricted users are sent to the shop
 * **Block themes** — replaces the “No products found” block with a role-aware login
   or logout prompt

**Developer-friendly extensibility**

 * 20+ filters and actions covering every stage of the visibility pipeline
 * Inject runtime rules (subscription-based, time-limited) without touching plugin
   files
 * Add custom taxonomy targets, override redirect URLs, or map membership levels
   to roles
 * HPOS (High Performance Order Storage) compatible

### Perfect for

 * **Wholesale / B2B stores** — hide retail products from registered wholesalers,
   or hide wholesale products from regular customers
 * **Membership and subscription sites** — restrict premium products to paying members
 * **Private catalogs** — require an account before any product is shown
 * **Tiered product access** — show different product sets to different customer
   segments

## 屏幕截图

[⌊Global rules settings page — add, prioritize, and duplicate visibility rules.⌉⌊
Global rules settings page — add, prioritize, and duplicate visibility rules.⌉[

Global rules settings page — add, prioritize, and duplicate visibility rules.

[⌊Product edit screen — "Hide by Role" tab for per-product role control.⌉⌊Product
edit screen — "Hide by Role" tab for per-product role control.⌉[

Product edit screen — “Hide by Role” tab for per-product role control.

[⌊Variation visibility — per-variation role checkboxes inside the variable product
editor.⌉⌊Variation visibility — per-variation role checkboxes inside the variable
product editor.⌉[

Variation visibility — per-variation role checkboxes inside the variable product
editor.

[[

[[

[[

## 安装

#### Automatic installation

 1. In your WordPress admin, go to **Plugins > Add New**.
 2. Search for **Hide Products by User Role for WooCommerce**.
 3. Click **Install Now**, then **Activate**.

#### Manual installation

 1. Download the plugin ZIP from WordPress.org.
 2. In your WordPress admin, go to **Plugins > Add New > Upload Plugin**.
 3. Upload the ZIP file and click **Install Now**, then **Activate**.

#### First-time setup

**Step 1 — Add a global rule**

 1. Go to **WooCommerce > Settings > Products > Hide by User Roles**.
 2. Click **Add Rule**.
 3. Choose a **User Role** (e.g. _Guest_, _Subscriber_, or any custom role).
 4. Choose a **Target**: _All Products_ to hide everything, _Product Category_ to hide
    a category, or _Product Tag_ to hide by tag.
 5. For category or tag targets, select the specific terms in the Terms column.
 6. Use the **arrow buttons** to set rule priority. Rules at the top are evaluated 
    first; an _All Products_ rule short-circuits all lower rules for that role.
 7. Click **Save changes**.

**Step 2 — Hide an individual product (optional)**

 1. Open any WooCommerce product in the editor.
 2. Click the **Hide by Role** tab in the Product Data panel.
 3. Check the roles that should not see this product.
 4. Click **Update**.

**Step 3 — Hide a specific variation (optional)**

 1. Open a variable product and expand the **Variations** section.
 2. Each variation has a **Hide by Role** section with per-role checkboxes.
 3. Check the roles to hide that variation from, then save.

## 常见问题

### Can I hide all products from guests?

Yes. Add a rule, set the role to _Guest_ and the target to _All Products_. Unauthenticated
visitors will see no products on the shop page, in search results, or on any product
page — direct URL access redirects them to the login page.

### Will hidden products be removed from search results too?

Yes. The plugin filters all WooCommerce product queries, including shop, category
and tag archives, search results, and the WooCommerce REST API.

### Does it redirect users who access a hidden product’s URL directly?

Yes. Guests are redirected to the WordPress login page (with a return URL so they
land back on the product after logging in). Logged-in users whose role hides the
product are redirected to the shop. You can override the redirect URL with the `
riaco_hpburfw_redirect_url` filter.

### Can I hide individual product variations?

Yes. Open a variable product, expand any variation in the **Variations** tab, and
you will find a **Hide by Role** section with per-role checkboxes.

### Does it work with WooCommerce HPOS (High Performance Order Storage)?

Yes. The plugin declares full compatibility with WooCommerce High Performance Order
Storage.

### Does it work with block themes and the WooCommerce block editor?

Yes. The plugin filters block-based product collection queries and replaces the “
No products found” block with a relevant login or logout message when a global hide
rule is active for the current user’s role.

### Does it work with FiboSearch / DGWT WooCommerce Ajax Search?

Yes. Visibility rules are applied automatically to FiboSearch queries.

### How does rule priority work?

Rules are evaluated from the top of the list downward. If an _All Products_ rule
matches the current user’s role, evaluation stops immediately — no lower rules are
checked. Move higher-priority rules to the top using the arrow buttons. Rules with
equal priority are evaluated in the order they were created.

### Can I add custom targets such as custom taxonomies?

Yes. Use the `riaco_hpburfw_targets` filter to add any registered taxonomy as a 
target in the settings page dropdown.

### Can I add rules programmatically or at runtime?

Yes. Use the `riaco_hpburfw_visibility_rules` filter to inject rules at runtime (
useful for subscription-based or time-limited rules) without saving them to the 
database. Use `riaco_hpburfw_rule_applies` to add extra conditions on top of the
base role match.

### Is it compatible with membership or subscription plugins?

The plugin works with any user role that WordPress recognises. If your membership
plugin assigns roles, those roles will appear in the settings automatically. Use
the `riaco_hpburfw_roles` filter to expose non-role membership levels, and `riaco_hpburfw_rule_applies`
to add time-based or subscription-status conditions.

## 评价

![](https://secure.gravatar.com/avatar/38bc6ed99a81940839372b6eaaecffb25320f6034f57759ffae3a1c9cb04e726?
s=60&d=retro&r=g)

### 󠀁[it works like a charm](https://wordpress.org/support/topic/it-works-like-a-charm-72/)󠁿

 [wocdev](https://profiles.wordpress.org/wocdev/) 2026 年 1 月 21 日 1 回复

The plugin works perfectly and is highly configurable directly from the WooCommerce
settings. It doesn’t add unnecessary items to the main menu, which is a big plus.
Thanks, Roberto!

 [ 阅读所有1条评价 ](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/)

## 贡献者及开发者

「Hide Products by User Role for WooCommerce」是开源软件。 以下人员对此插件做出了
贡献。

贡献者

 *   [ robertoiacono ](https://profiles.wordpress.org/prototipo88/)

[帮助将「Hide Products by User Role for WooCommerce」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/riaco-hide-products-by-user-role)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/riaco-hide-products-by-user-role/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/riaco-hide-products-by-user-role/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/riaco-hide-products-by-user-role/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/riaco-hide-products-by-user-role/)。

## 更新日志

#### 1.1.1

 * Fixed per-product hiding silently failing without global rules.

#### 1.1.0

 * Added Product Tag as a global rule target alongside Product Category.
 * Added duplicate rule button in the global rules settings table.
 * Added Priority column to the rules table and rule-count badge in the WooCommerce
   settings nav.
 * Added Settings quick-link in the Plugins list for faster access.
 * Added admin footer review prompt on the plugin settings screen.
 * Added inline confirmation dialog on rule removal to prevent accidental deletes.
 * Added empty-state message when no rules exist yet.
 * Added 10+ new extensibility filters and actions for developer extension plugins.
 * Added FiboSearch (DGWT WooCommerce Ajax Search) compatibility.
 * Added block theme support: replaces the “No products” block with a role-aware
   login or logout message.
 * Fixed visibility not applied to WooCommerce REST API product queries.
 * Fixed variation hide rules not respected for authenticated users accessing products
   via REST API.
 * Fixed text domain to match plugin slug.

#### 1.0.0

 * Initial release.

## 额外信息

 *  版本 **1.1.1**
 *  最后更新：**4 月前**
 *  活跃安装数量 **40+**
 *  WordPress 版本 ** 6.2 或更高版本 **
 *  已测试的最高版本为 **7.0.7**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/riaco-hide-products-by-user-role/)
 * 标签
 * [hide products](https://cn.wordpress.org/plugins/tags/hide-products/)[product visibility](https://cn.wordpress.org/plugins/tags/product-visibility/)
   [restrict products](https://cn.wordpress.org/plugins/tags/restrict-products/)
   [user role](https://cn.wordpress.org/plugins/tags/user-role/)[woocommerce](https://cn.wordpress.org/plugins/tags/woocommerce/)
 *  [高级视图](https://cn.wordpress.org/plugins/riaco-hide-products-by-user-role/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/?filter=1)

[您的评价](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/reviews/)

## 贡献者

 *   [ robertoiacono ](https://profiles.wordpress.org/prototipo88/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/riaco-hide-products-by-user-role/)