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
Legend Used On This Page
The tab a setting belongs to
โ
Tip / Recommendation
โ ๏ธ Caution / Warning
โ Risky Area
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 Rules | Number of rules currently set to "Active" |
| Hidden Products | Unique products directly targeted by an active "Hide product" rule |
| Customers Targeted | Unique customer accounts referenced by an active rule's "Customer" condition |
| Inactive Rules | Number 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 status | is | Logged in / Logged out |
| User role | is / is not | Any registered WordPress/WooCommerce role |
| Customer | is | Specific customer account(s), found via live search |
| Country | is / is not / in / not in | The visitor's billing (or shipping) country |
| Product | is | Specific product(s), found via live search |
| Product category | is | Specific 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.
08
TAB
System Status
A read-only environment and compatibility overview, useful when contacting support.
| Row |
Shows |
| Plugin / WordPress / WooCommerce / PHP Version | Currently installed versions |
| HPOS | Whether High-Performance Order Storage is enabled (supported either way) |
| Cart & Checkout Blocks / Product Editor | Always "Supported" |
| Object Cache | Whether an external persistent object cache (e.g. Redis/Memcached) is active |
| Multisite | Whether this is a WordPress multisite install |
| Database Schema | Whether 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 โ WooCommerce Product Visibility Rules โ Documentation ยท Version 1.0.0