Contents
Introduction
Product Visibility by User Role for WooCommerce Pro plugin lets you show/hide WooCommerce products depending on customer’s user role.
Settings
Plugin settings are located in “WooCommerce > Settings > Product Visibility”. To set user roles on a per-product basis, there is also a “Product visibility” meta box on each product’s edit page.
General Options
Start by visiting “General” options section in “WooCommerce > Settings > Product Visibility by User Role > General”. Here you can choose how products should be hidden:
- Hide catalog visibility
- This will hide selected products in shop and search results only. Hidden products will still be accessible via direct link, unless “Modify query” is enabled.
- Default:
yes
- Default:
- Make non-purchasable
- This will make selected products non-purchasable (i.e. product can’t be added to the cart).
- Default:
yes
- Default:
- Modify query
- This will hide selected products completely. Accessing via direct link will return an “error 404 / product not found” page.
- Default:
yes
- Default:
- Hide menu items
- Hides nav menu items (i.e. hidden products, product categories and tags). Only products, product categories/tags marked in bulk settings will be hidden. This options uses the
wp_get_nav_menu_items
filter.- Default:
no
- Default:
- Hide product categories/tags
- Hides products categories and tags from being displayed on front-end. Only categories/tags marked in bulk settings will be hidden. This options works filtering terms from
get_terms()
function. Accessing via direct link will return an “error 404 / category not found” page.- Default:
no
- Default:
- Redirect
- This option is useful only if Modify query is enabled. Instead of showing your 404 page, redirect to a custom URL. Applies only to products, product categories, and tags which were made invisible by our plugin.
- Default: None
- Redirect: Redirect URL per product
- This will add a “Product visibility: Redirect URL” metabox to each product’s edit page, allowing you to set different redirects per product.
- Default:
no
- Default:
- Replace description
- This will replace the content in the “Description” tab for the selected products.
- Default:
no
- Default:
- Replace description: Content to replace with
- E.g.:
<strong><a target="_blank" href="/wp-login.php">Log in</a> to see the product description.</strong>
- Default: None
- Replace short description
- This will replace the content in the “Product Short Description” tab for the selected products.
- Default:
no
- Default:
- Replace short description: Content to replace with
- E.g.:
<strong><a target="_blank" href="/wp-login.php">Log in</a> to see the product description.</strong>
- Default: None
Per Product Options
After settings general option you can you can set included or excluded user roles for each product individually – go to product’s edit page and locate “Product visibility” meta box:
Why can’t I use both “Visible” and “Invisible” at the same time?
Because you don’t need to — they are mutually-exclusive. If we mark a product as “Visible” only to 1 user role, then logically it must be invisible to all others, right? Conversely, if we mark a product as “Invisible” to only 1 user role, then logically it must be visible to all the rest.
Example: in the screenshot above, we’ve set a product to be visible ONLY to the user roles Customer, Shop manager, Exempt Customer, and Vendor. Thus any other user roles we didn’t enter (like Guest, Subscriber, etc.) will be hidden.
You can accomplish the same result with either setting, but depending on your situation one may simply be easier than the other. For example, if you only have 1 or 2 you want to be hidden, it’s easy to use the “Invisible” setting. If you have more to be hidden than shown, it might be easier to use the “Visible” setting. It’s up to you to choose which way you prefer.
Admin Options
- User roles to display in settings
- Leave blank to show all available user roles.
- Default: None
- Admin products list column
- This will add “User Roles” column to the admin products list.
- Default:
no
- Default:
- Product quick edit
- This will add “User Roles” options to the product quick edit screen.
- Default:
no
- Default:
- Products bulk edit
- This will add “User Roles” options to the products bulk edit screen.
- Default:
no
- Default:
Bulk Options
The premium version allows you to set user roles visibility options in bulk — for multiple products at once, product categories or product tags. In “WooCommerce > Settings > Product Visibility by User Role > Bulk Settings” you can set which products, product categories or tags are visible or invisible to certain role. If you fill in “Visible” option, then users with selected role will be able to see only chosen products. If you fill in “Invisible” option, then chosen products will be hidden for users with that role.
Why can’t I use both “Visible” and “Invisible” at the same time?
Because you don’t need to — they are mutually-exclusive. “Invisible” means to take something and make it hidden, while all the rest remain visible. However the “Visible” setting works the opposite way — it means to take something and make ONLY what’s entered visible, while all the rest become hidden.
You can accomplish the same result with either setting, but depending on your situation one may simply be easier than the other. For example, if you only have 1 or 2 you want to be hidden, it’s easy to use the “Invisible” setting. If you have more to be hidden than shown, it might be easier to use the “Visible” setting. It’s up to you to choose which way you prefer.
Frequently Asked Questions
Q. I have a pagination issue: the number of products on each page turns out random depending on which products are hidden. What should I do?
A. You need to enable “Modify query” checkbox in plugin “General” settings section (in “WooCommerce > Settings > Product Visibility”).