You don’t always need additional plugins to manage the product visibility in your WooCommerce store. Using WooCommerce’s built-in settings, you can control which products appear in your shop, search results, and for specific customers.
For example, you might need to hide individual items and entire product categories or restrict visibility based on user roles. While it might seem complicated, it’s absolutely possible to do so without any plugins, and these native approaches will give you precise control over your inventory display while maintaining optimal site performance.
Let’s explore how you can leverage WooCommerce’s core functionality to create a more tailored shopping experience for your customers.
What are hidden products in WooCommerce?
Hidden products in WooCommerce are items that exist in your store’s database but don’t appear on your main shop page, category pages, or search results. But these products remain accessible via direct URL links (unless additional measures are taken).
Hidden products typically share these characteristics:
- Invisible to some or all users browsing your store
- Potentially excluded from search engine indexing
- Manageable through various visibility settings
You can implement product hiding at different levels depending on your needs:
- Individual product basis
- Entire product categories
- Store-wide restrictions
The method you choose depends on your specific business requirements and how you want customers to interact with your inventory.
When might you want to hide a product?
It might sound strange initially, but there are numerous valid reasons to hide certain products in your WooCommerce store. Let’s explore the most common scenarios where product hiding proves valuable:
Product development and inventory management
- During product development, you might need to add items to your store before they’re ready for public viewing. This allows you to set up descriptions, pricing, and images without customers seeing incomplete listings.
- Temporarily out-of-stock items can be hidden instead of deleted, so you can preserve their data until you have more stock. This approach maintains your product information while preventing customers from ordering unavailable merchandise.
- Hiding seasonal items like holiday decorations or summer gear during off-season keeps your store organized and focused on currently relevant offerings.
Business model requirements
- If you operate a hybrid retail/wholesale business, you might want to hide wholesale-only products from regular retail customers. This creates a cleaner shopping experience for retail buyers while maintaining exclusive pricing for wholesale accounts.
- Membership sites often offer premium products only to paying members. Hiding these items from non-members creates exclusivity and adds value to memberships.
- Products with geographic shipping restrictions (like perishable goods or items with legal limitations) can be hidden from customers in regions where delivery isn’t possible.
Marketing and operational strategies
- When partnering with specific retailers, you might need to hide branded products intended only for those partners’ customers.
- During website redesigns or major updates, temporarily hiding certain products prevents customers from seeing items that might have display issues.
- For flash sales or limited-time offers, hiding products until the promotion begins builds anticipation and prevents early purchases at regular prices.
Here are some more specific examples:
Scenario | Example |
---|---|
Testing phase | New model of a product with specs still being finalized |
Out-of-stock | Limited edition items awaiting restock |
Seasonal products | Christmas ornaments in April |
Wholesale only | Bulk pack of 500 units with special pricing |
Membership products | Premium educational materials for subscribers |
Geographic restrictions | Fresh food deliveries outside the delivery radius |
Partner-specific | Co-branded merchandise for specific retailers |
Website updates | Products being recategorized or repriced |
Pre-launch | Flash sale items before a Black Friday promotion |
Campaign-specific | Products tied to email marketing campaigns |
How to hide individual products in WooCommerce without plugins
Hiding individual products in WooCommerce is straightforward using the platform’s built-in settings. This method is perfect when you need to temporarily remove specific items from your store’s catalog without deleting them completely.
WooCommerce includes a native “Catalog Visibility” setting that lets you control whether products appear in your shop pages and search results. Here’s how to use it:
Step-by-step instructions to hide a product
- Log into your WordPress admin dashboard and navigate to All Products in the left sidebar menu.
- Find the product you want to hide from your list and click Edit to open the product editing screen.
- On the right side of the screen in the Publish section, find the Catalog visibility option (by default set to “Shop and search results”).
- Click the Edit link next to this visibility setting and select the Hidden option from the dropdown menu. Click OK to confirm your selection.
- Click the Update button to save your changes.
Important limitations to know about
This method comes with a few important limitations you should be aware of:
- Products hidden this way will not appear on your shop page, category pages, or in search results.
- They will still be accessible via direct URL links, meaning if someone knows the URL (or bookmarked the product URL), they can still view and purchase the item.
- Search engines may still index these products unless you use additional SEO settings. SEO plugins will automatically do that for you.
Bulk hiding considerations
Hiding products one by one using this method can become tedious if you have many items to hide. For larger collections, consider these alternatives:
- Assign products to a specific category and then hide the entire category (more efficient).
- Use the bulk edit feature to select multiple products and edit their visibility settings simultaneously.
- Use custom code snippets for more advanced visibility controls.
How to hide a product category in WooCommerce
To hide both a category and its products in WooCommerce without plugins, you’ll need to use code snippets that filter out products from specific categories. Here’s how to do that:
Add this code snippet to your child theme’s functions.php file:
add_action( 'pre_get_posts', 'myfunction_hide_category_products_from_loops', 999 );
function myfunction_hide_category_products_from_loops( $query ) {
// Only target the front end's main query for products:
if ( ! is_admin() && $query->is_main_query() ) {
// Check if this is a product archive or search for products
// is_shop() covers the main shop page
// is_product_taxonomy() covers category/tag archives
// is_search() + post_type check covers product searches
if ( is_shop() || is_product_taxonomy() || ( is_search() && 'product' === $query->get('post_type') ) ) {
// Append a tax_query condition that excludes the category by slug
$tax_query = (array) $query->get('tax_query');
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'your-category-slug' ), // Change to the correct category slug
'operator' => 'NOT IN',
);
$query->set('tax_query', $tax_query);
}
}
}
Code language: PHP (php)
This code tells WordPress to modify the main product query (the list of products you see) so that products assigned to the specified category do not appear on:
- The main WooCommerce shop page (
is_shop()
). - Product category/tag archives (
is_product_taxonomy()
). - Product search results (
is_search() && 'product' === $query->get('post_type')
).
It executes during WordPress’s pre_get_posts
action, but only when these conditions are met:
- You’re not in the WordPress admin (
! is_admin()
), so it only applies to the front end. - It’s the main query (
$query->is_main_query()
), meaning this is the primary list of items that WordPress is generating for a given page – not a secondary custom query in a widget, for example. - It’s one of the targeted product pages (shop, product category/tag archive, or product search).
Replace category-slug-1
, category-slug-2
with the actual slug(s) of the categories you want to hide. This code will prevent products from those categories from appearing on your shop page.
To find the category slug, in the WordPress admin, go to Products → Categories. You’ll see a table with the image, name, description, slug, and count of each category. Just copy the slug and paste it in the code.
If you don’t want to exclude the categories globally (shop/tax/archive/search), you can replace if ( is_shop() || is_product_taxonomy() || ( is_search() && 'product' === $query->get('post_type') ) )
with more targeted checks, for example:
if ( is_shop() ) { ... }
– Only on the main Shop pageif ( is_page( 999 ) ) { ... }
– Only on the page with ID = 999if ( is_page( array( 999, 1001 ) ) ) { ... }
– Multiple page IDsif ( is_page( 'your-page-slug' ) ) { ... }
– A page slugif ( is_front_page() ) { ... }
– The homepage
You can combine these with logical operators (||
for OR, &&
for AND) to precisely target where products are hidden.
Now we need to hide the Category from Category Listings/Widgets. WooCommerce uses separate arguments when it displays lists of product categories (like in the “Product Categories” widget or subcategory listings). We’ll exclude the category ID from those:
add_filter( 'woocommerce_product_subcategories_args', 'myfunction_exclude_category_from_subcategories' );
add_filter( 'woocommerce_product_categories_widget_args', 'myfunction_exclude_category_from_subcategories' );
function myfunction_exclude_category_from_subcategories( $args ) {
// You must use the *ID* of the category here, not the slug.
$args['exclude'] = array( 123 ); // Replace 123 with the actual category ID
return $args;
}
Code language: PHP (php)
This snippet excludes a specific product category by ID from 2 places:
- Product subcategories list in WooCommerce archives (
woocommerce_product_subcategories_args
filter). - Product categories widget in your sidebar or wherever you place the WooCommerce categories widget (
woocommerce_product_categories_widget_args
filter).
To find the Category ID:
- In the WordPress admin, go to Products → Categories.
- Hover over your target category or click Edit.
- Look in the browser’s address bar for something like tag_ID=123. That number (e.g. 123) is the category ID.
How to hide products in WooCommerce based on user roles
This can be done without a plugin by adding custom PHP code to your theme’s functions.php file.
Suppose you run a store where, when a user logs in with the “Member” role, they see extra items not visible to non-members. You can do this by adding the following code snippets to your child theme’s functions.php file:
function hide_vip_items_from_non_members( $query ) {
// Make sure we're not in the admin area
if ( is_admin() ) {
return;
}
// Only modify the main product query (e.g. Shop page, product categories, etc.)
if ( ! $query->is_main_query() ) {
return;
}
// Check the user's roles
$current_user = wp_get_current_user();
if ( ! in_array( 'member', (array) $current_user->roles ) ) {
// For non-members, exclude the "vip-members-only" category
$tax_query = (array) $query->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'vip-members-only' ),
'operator' => 'NOT IN',
);
$query->set( 'tax_query', $tax_query );
}
}
add_action( 'woocommerce_product_query', 'hide_vip_items_from_non_members' );
Code language: PHP (php)
This snippet:
- Hooks into the
woocommerce_product_query
action, which WooCommerce fires whenever it builds the main query for products (front end only). - Skips admin pages (
is_admin() check
) to avoid messing with admin product lists. - Checks if the query is the main query for the page (
$query->is_main_query()
). - Determines the current user’s roles (via
wp_get_current_user()
), and if the user does not have the role “member,” then it adds atax_query
rule that excludes products in the categoryvip-members-only
.
Don’t forget to:
- Change
vip-members-only
to your actual product category slug. - Replace
member
with your custom role slug (e.g.premium_member
,vip
, etc.). - If you only want to hide items on the shop page and not on category archives (or vice versa), you can replace
is_main_query()
with more targeted checks likeis_shop()
,is_product_taxonomy()
, oris_search()
.
If you want to exclude specific products by ID rather than by category, the general idea is to use the same hook (woocommerce_product_query
) but add product IDs to the post__not_in
parameter instead of adding a tax_query
, like so:
// For NON-members, exclude product IDs
// Replace these with your actual product IDs
$excluded_ids = array( 100, 101, 102 );
// Merge with any existing excluded products
$post__not_in = (array) $query->get( 'post__not_in' );
$post__not_in = array_merge( $post__not_in, $excluded_ids );
$query->set( 'post__not_in', $post__not_in );
Code language: PHP (php)
Explain that you can also make products non-purchasable or remove prices based on user roles using similar filter hooks. This approach will hide selected products in shop and search results, though they may still be accessible via direct link.
The downsides of hiding products in WooCommerce
While WooCommerce’s product hiding features are useful, they come with several limitations you should consider:
- Products hidden through standard visibility settings remain accessible via direct URLs, potentially creating security gaps for exclusive items.
- Hidden products may still appear in your site’s XML sitemap, affecting search engine indexing and possibly your site’s SEO performance.
- For stores with large inventories, managing hidden products becomes challenging without automated systems, especially when products need regular visibility changes.
- Inventory reports might not accurately distinguish between visible and hidden products, complicating stock management decisions.
- The inconsistent appearance of products can confuse customers who find items through external links but not through your main navigation.
- Custom code solutions require careful implementation and testing to avoid breaking your store functionality.
Now you know how to hide products without plugins
You’ve learned 3 powerful methods to control product visibility in WooCommerce without extra plugins: hiding individual products using catalog visibility settings, concealing entire categories with custom code snippets, and restricting products based on user roles.
When implementing code-based solutions, always use a child theme for your modifications!