Linux 软件免费装
Banner图

Hide Products by User Role for WooCommerce

开发者 prototipo88
更新时间 2026年6月16日 20:05
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPL v2 or later
版权网址: 版权信息

标签

woocommerce user role hide products product visibility restrict products

下载

1.0.0 1.1.0 1.1.1

详情介绍:

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. 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 Key Features Global visibility rules (WooCommerce > Settings > Products > Hide by User Roles) Per-product and per-variation control Complete query coverage — hidden means truly hidden Developer-friendly extensibility Perfect for

安装:

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.

屏幕截图:

  • Product edit screen — "Hide by Role" tab for per-product role control.
  • Variation visibility — per-variation role checkboxes inside the variable product editor.

升级注意事项:

1.1.1 Bug fix: per-product hiding now works correctly when no global rules are configured. 1.1.0 Includes REST API bug fixes and significant new features. Update recommended for all users.

常见问题:

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.

更新日志:

1.1.1 1.1.0 1.0.0