Idea Plugins
Idea Plugins

๐Ÿ”’ WooCommerce Product Visibility Rules โ€” Documentation

Build simple IF/THEN rules that control exactly who can see a product, whether its price shows, whether Add to Cart is available, and what message shoppers see instead. This page explains what every setting does and which part of the store it controls.

Version 1.0.0 HPOS, Blocks & Product Editor Compatible Server-Side Enforced
WooCommerce Product Visibility Rules interface preview
Legend Used On This Page
The tab a setting belongs to
โœ… Tip / Recommendation
โš ๏ธ Caution / Warning
โ›” Risky Area
Table of Contents
  1. Setup & Menu Location
  2. First-Run Onboarding
  3. Dashboard Tab
  4. Rules Tab
  5. Rule Builder (Create / Edit)
  6. Settings Tab
  7. Tools Tab
  8. System Status Tab
  9. How Enforcement Works
  10. Frequently Asked Questions
01

Setup & Menu Location

This plugin requires WooCommerce. After installing and activating both plugins, the settings screen can be found here:

WordPress Admin Menu โ†’ WooCommerce โ†’ ๐Ÿ”’ Product Visibility
โš ๏ธ Warning: This menu only appears when WooCommerce is installed and active. If WooCommerce is missing, the plugin shows an admin notice instead of loading its settings. Access requires the "manage_woocommerce" capability (typically the Administrator / Shop Manager roles).
02

First-Run Onboarding

The very first time the plugin's admin page is opened (before any rule exists), a simple welcome screen is shown instead of the Dashboard, outlining the 4-step flow: Choose conditions โ†’ Choose action โ†’ Select products โ†’ Save.

  • Create Your First Rule โ€” jumps straight into the Rule Builder.
  • Skip setup โ€” dismisses onboarding and goes to the Dashboard instead.
โœ… Either choice marks onboarding as complete โ€” it is never shown again once dismissed or once your first rule exists.
03

TAB Dashboard

A quick, at-a-glance overview of your rules, with conflict warnings and shortcuts to recent rules.

๐Ÿ“Š Stat Cards
Card What It Shows
Active RulesNumber of rules currently set to "Active"
Hidden ProductsUnique products directly targeted by an active "Hide product" rule
Customers TargetedUnique customer accounts referenced by an active rule's "Customer" condition
Inactive RulesNumber of rules currently set to "Inactive"
โš ๏ธ Conflict Warning Banner

Appears when two active rules target overlapping products with opposing Show/Hide actions. This is only a heuristic warning, not a hard block โ€” the higher-priority rule always wins.

๐Ÿ“‹ Recent Rules

Your 5 most recent rules, each with a quick on/off toggle and an Edit shortcut straight into the Rule Builder.

04

TAB Rules

The full list of every rule you've created, with search, filtering, sorting, and bulk actions.

๐Ÿ” Toolbar
  • Search rules โ€” instantly filters by rule name.
  • Status filter โ€” All statuses / Active / Inactive.
  • Sort โ€” Priority (highโ†’low or lowโ†’high), Name (Aโ†’Z), Newest first.
  • Activate / Deactivate / Delete โ€” bulk actions, enabled once one or more rules are selected via checkbox.
๐Ÿ—‚๏ธ Each Rule Row

Shows the rule name, an Active/Inactive badge, the matched action(s), the target scope (e.g. "3 products", "All products"), and its priority.

  • On/off switch โ€” activates or deactivates the rule instantly.
  • Edit (pencil icon) โ€” opens the Rule Builder for that rule.
  • Duplicate โ€” creates an inactive copy named "<Rule> - Copy" with a brand-new ID, so you can safely adjust it before activating.
  • Delete (trash icon) โ€” permanently removes the rule after confirmation.
05

Rule Builder (Create / Edit)

A visual, no-code IF/THEN builder. Every rule follows the same structure: IF these conditions match THEN apply these actions to this Target scope.

๐Ÿท๏ธ Rule Name

An internal label to recognize the rule later (e.g. "Wholesale Only Products"). Required.

๐Ÿงฉ IF โ€” Conditions

Add one or more conditions, combined with either AND (all must match) or OR (any one match is enough), toggled at the top of the card.

Condition Operators Matches
Login statusisLogged in / Logged out
User roleis / is notAny registered WordPress/WooCommerce role
CustomerisSpecific customer account(s), found via live search
Countryis / is not / in / not inThe visitor's billing (or shipping) country
ProductisSpecific product(s), found via live search
Product categoryisSpecific product categor(y/ies)
โšก THEN โ€” Actions

Choose one or more of the four available actions. Each action can carry its own optional message shown to the shopper (rich text: bold, italic, line breaks, links).

  • Show product โ€” explicitly whitelists a product, overriding a broader "hide" rule when combined via target scoping.
  • Hide product โ€” the product becomes fully inaccessible: removed from shop/category/search listings and returns a 404 if visited directly (unless the visitor can manage WooCommerce).
  • Hide price โ€” the price is removed from every price display, server-side.
  • Hide Add to Cart โ€” the button/link is hidden and the product becomes non-purchasable; direct add-to-cart requests are also blocked.
๐ŸŽฏ Target

Which products this rule's actions apply to, independent of its conditions.

  • All products โ€” the rule can apply store-wide.
  • Specific products โ€” search by name or SKU and pick individual products.
  • Categories โ€” apply to every product in the selected categor(y/ies).
  • Tags โ€” apply to every product carrying the selected tag(s).
โœ… Tip: a "Product" or "Category" condition is different from the Target field โ€” Target scopes which products the rule can affect at all, while a matching Product/Category condition additionally requires the viewed product itself to match.
๐Ÿ”ข Priority & Status
  • Priority (0โ€“999) โ€” when multiple active rules match the same product/visitor, the single highest-priority rule wins outright and determines every outcome; ties are broken deterministically by the higher rule ID (never by unpredictable database order).
  • Status โ€” Active/Inactive switch, same as the list view's toggle.
๐Ÿงช Test Rule

Simulate a visitor โ€” pick a Country and a User Role (or "Logged out") โ€” and click Test to see a condition-by-condition breakdown of whether this specific rule would match, without needing a real test account.

โœ… The tester only evaluates the rule you're currently editing โ€” it does not simulate interaction with your other rules or their priorities.
06

TAB Settings

Four sub-tabs, each with its own independent "Save Changes" button โ€” saving one sub-tab never touches the others.

โš™๏ธ General
  • Enable plugin โ€” master kill switch for all rule evaluation, store-wide.
  • Default rule priority โ€” the priority value pre-filled for newly created rules.
๐Ÿ‘๏ธ Visibility
  • Hide products from โ€” "Shop, category & search" or "Shop & category only" (i.e. whether hidden products are also excluded from on-site search results).
  • Default restriction message โ€” shown whenever a matching action has no custom message of its own.
  • Message alignment โ€” Left / Center / Right.
  • Show icon โ€” toggles the small lock icon next to the restriction message.
  • Button text & Button URL โ€” an optional call-to-action button under the message (e.g. "Login" โ†’ the My Account page).
โšก Performance
  • Enable caching โ€” caches rule evaluation results (per visitor context) to keep shop pages fast.
  • Cache duration (seconds) โ€” how long a cached result is kept before being re-evaluated. Minimum 60 seconds.
  • Clear Cache Now โ€” immediately invalidates every cached evaluation, useful right after a rule change if you don't want to wait for the natural expiry.
๐Ÿ› ๏ธ Advanced
  • Debug mode โ€” shows a small "Visibility debug" panel on the single product page listing the matched rule ID and hide_product/hide_price/hide_cart outcomes. Visible only to users who can manage WooCommerce โ€” never shown to shoppers.
  • Delete plugin data on uninstall โ€” off by default.
โ›” Caution: enabling "Delete plugin data on uninstall" means that the next time this plugin is deleted from the Plugins screen, every rule, the plugin's database table, and all its settings are permanently removed. This cannot be undone.
07

TAB Tools

Export, import, cache, and log maintenance utilities.

๐Ÿ“ค Export

Downloads every rule and setting as a single JSON file โ€” useful for backups or moving your configuration to another store.

๐Ÿ“ฅ Import

Upload a previously exported JSON file, choosing how it should combine with what's already here:

  • Keep existing + add imported rules โ€” merges the file's rules alongside your current ones.
  • Replace all rules โ€” the imported file's rules become the complete rule set.
โš ๏ธ "Replace all rules" removes every rule not present in the imported file. Export a backup first if you're unsure.
โšก Cache

A duplicate of the Performance sub-tab's "Clear Cache Now" button, provided here for convenience.

๐Ÿงพ Logs

Diagnostic logs covering rule evaluation, migrations, and API errors. "Clear Logs" permanently empties this log.

08

TAB System Status

A read-only environment and compatibility overview, useful when contacting support.

Row Shows
Plugin / WordPress / WooCommerce / PHP VersionCurrently installed versions
HPOSWhether High-Performance Order Storage is enabled (supported either way)
Cart & Checkout Blocks / Product EditorAlways "Supported"
Object CacheWhether an external persistent object cache (e.g. Redis/Memcached) is active
MultisiteWhether this is a WordPress multisite install
Database SchemaWhether the plugin's database table is on the current, expected version
09

How Enforcement Works

Every restriction is enforced server-side, not just hidden with CSS. This is what makes the plugin's rules impossible to bypass from the front end.

๐Ÿšง Enforcement Points
  • Shop / category / search listings โ€” hidden products are excluded from the query itself, not just visually removed.
  • Single product page โ€” a hidden product returns a genuine 404 for restricted visitors (unless they can manage WooCommerce).
  • Related products โ€” hidden products never appear in the "You may also like" section.
  • Classic Add to Cart โ€” direct add-to-cart URLs and form submissions are rejected with an error notice.
  • Store API (Cart & Checkout Blocks) โ€” a restricted add-to-cart request is rejected with a 403 error, so the block-based cart/checkout can't be used to bypass a rule either.
  • Existing cart items โ€” re-checked on every cart view; if a rule now restricts an item already in someone's cart (e.g. an admin just changed a rule), it's automatically removed with a notice.
โœ… Hiding the Add to Cart button or price is only a visual convenience โ€” the actual security boundary is always the server-side checks above, so restrictions hold even against direct requests or browser dev tools.
10

Frequently Asked Questions

Does deactivating or deleting the plugin remove my rules?

No. Deactivating always preserves your data. Uninstalling also preserves your data by default โ€” you must explicitly enable "Delete plugin data on uninstall" under Settings โ†’ Advanced to remove it.

Is this compatible with HPOS?

Yes, and it works correctly whether HPOS is enabled or not.

Does hiding a product also block adding it to the cart directly?

Yes โ€” visibility and cart access are enforced server-side, not just with CSS, across classic checkout, direct add-to-cart URLs, and the Store API.

What happens when two active rules conflict?

The single highest-priority matching rule wins outright and determines the entire outcome. If priorities tie, the rule with the higher ID wins โ€” this is always deterministic, never dependent on database ordering. The Dashboard also surfaces a warning banner when it detects overlapping Show/Hide rules on the same product.

Can I extend this with custom conditions or actions?

Yes. Developers can register new condition types via the ideapvsr_register_condition filter and new action types via ideapvsr_register_action. See the developer README for the full hook reference.

Idea Plugins
๐Ÿ“„ Documentation โ†— โœ‰๏ธ Contact support โ†— ๐ŸŒ Website โ†—
Idea Plugins โ€” WooCommerce Product Visibility Rules โ€” Documentation ยท Version 1.0.0