Sometimes, you don’t want to show some products or data in your WooCommerce. In this article, you’ll learn how to hide products, whole product categories, or specific product data in WooCommerce. I have tried to get the most important tips for this topic with examples 🙂!
Table of contents
- How to hide product categories in WooCommerce
- Hiding specific products
- Remove related products
- Hide product price, SKU, or category on the product page
- How to bulk change product data in WooCommerce
How to hide product categories in WooCommerce
Let’s start with bigger puzzles 🧩🙂. You may want to hide the whole product categories in WooCommerce for testing or temporary development actions. No matter the reason, you can use the built-in theme/ Woo settings, adjust WooCommerce shortcodes to show products only from categories you want or use custom code, a plugin, or a combination of these options.
Remove product category in WooCommerce
If you want to hide a certain category for your products, and will not use that category in the future, the fastest solution would be deleting the WooCommerce product category entirely ❌.
You can use bulk actions if you need to delete several categories at once. Your products will be transferred to a default category, but of course, you can change the default category before deleting a category so that products end up in the category you want ↪️.
Similarly, you may hide some WooCommerce product categories by changing the category name, making it a child category so it’s no longer a parent category 🙂.
Adjust the WooCommerce shortcodes - exclude categories
You may also hide product categories in WooCommerce by modifying the shortcodes. Of course, if you use WooCommerce shortcodes on your posts or pages to show products.
For example, you can show all products but omit those from one or more categories by using the shortcode: products category="food, another-category, general" cat_operator="NOT IN" orderby="rating" order="DESC" limit="4" columns="2":
Shoppers will see products from all categories except those three I added in the shortcode.
It’s also possible to show the list of selected categories with the product_categories ids="" columns="4" shortcode (I've chosen two category IDs in my examples):
You can find the ID of each WooCommerce product category by hovering the Edit link in Products → Categories inside the shown URL (look for the value of tag_ID).
Customize WooCommerce display/ theme options
The last option, if you don’t want to use a plugin or custom code, is to use the theme options. Go to the Appearance → Customize (I use Storefront in my example).
Then, go to WooCommerce → Product Catalog and choose what to display on the shop page and category page by default.
Of course, you have better control with WooCommerce shortcodes or renaming/ deleting the specific product category. You can also add custom code, for example, to the theme’s functions.php file to hide products from showing in your store entirely by hooking to WooCommerce Product Query 💪.
Hiding specific products
To hide some WooCommerce products from default store pages, you can move them to trash (they can be restored so they are not deleted entirely) 🗑️.
You may also change the product visibility to “hidden” so that default pages won’t show them 🤫.
It’s also possible with the Quick Edit option and by editing more products at once.
If you use the WooCommerce shortcodes you can decide which products to show by using ids, skus, visibility, or hide products based on the specific attribute (and its terms), tag, or category with NOT_IN for terms_operator, tag_operator, and cat_operator. Let’s see 3 examples of the shortcode to modify the products you show/hide in WooCommerce.
Show specific products based on IDs
First, you can use the products ids="100,120,140" shortcode to show only those 3 products. You can find the product ID by hovering the product on the product list in WooCommerce.
Hide all WooCommerce products except featured ones
Next, you can use the shortcode to show only featured products: products visibility="featured", for example, if you want to share the best items in a blog post. You can find which products are featured in the product list in WooCommerce:
Hide WooCommerce products based on attribute, tag, and category
Finally, you can use the products shortcode with some parameters to hide products with some attributes, tags, or categories. Use products attribute="Size" terms="Large" terms_operator="NOT_IN" tag="imported" tag_operator="NOT_IN" category="food" cat_operator="IN" to hide large products or products with the tag “imported” and those from categories other than “food”.
Remove related products
Sometimes you want to hide the Related Products section from displaying on the product page. There are 3 options to hide the Related Products section from the product page 🎉.
Use CSS
The first one is quite easy. Add the section.related.products {display:none;}
to the theme’s CSS, for example in Appearance → Customize → Additional CSS.
It may also be possible to use your theme settings - look for the Related Products section.
Customize the template
If you have access and would like to do that 😀, you can adjust the product template inside your theme (or child theme) and delete the Related Products section there. Of course, you will not have to hide it with CSS then. This approach will be better for optimizing (less code and nice HTML structure). Some themes can overwrite the default layout too.
Remove the Related Products action
Finally, you can remove the action to generate Related Products from the single product pages with the code below (add it to your theme’s functions.php - remember about it after changing or updating your theme). I have also given you a code to hide upsell products 🙂.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
In my opinion, this option is the fastest way to hide the Related Products section 🌬️.
Hide product price, SKU, or category on the product page
The last issue related to hiding products I wanted to show you is removing specific information from the product page. For example the product price, SKU, or its category.
You can do this similarly to hiding the Related Products section by one of the following methods ⬇️.
Use CSS
The simplest way, and quite effective, is to hide the product price, SKU, and category with the appropriate CSS declaration. For example, to hide the product price (I don’t know why you’d like to do that 🤔) you could use: body.single-product p.price {display:none;}
or even in detail for regular and sale prices: body.single-product p.price del {}
and body.single-product p.price ins {}
.
To hide SKU, tags, or product category, it would be best to hide the meta elements with CSS: .single-product div.product .product_meta .sku_wrapper, .single-product div.product .product_meta .posted_in, .single-product div.product .product_meta .tagged_as {display:none;}
As you can guess, you could hide only one or two meta elements using the selected part of the CSS declaration 🙂 e.g. .single-product div.product .product_meta .posted_in, .single-product div.product .product_meta .tagged_as {}
This approach is quite efficient and fast. In my example, I wanted to show only the product SKU. As previously mentioned, add the custom CSS code to the style.css, theme’s CSS editor, or Additional CSS in the Appearance → Customize.
Customize the template
You can also adjust the PHP template files in your theme (child theme) and remove/ manage the information for the single product pages 💪.
Remove WooCommerce action
Finally, remove the whole meta section on the product page with a single line of code. Add it to your theme’s functions.php file (add it again after you change or update the theme) ♻️.
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
This approach is not the best if you’d like to leave some part of the meta but you can always use a custom function in this action instead of removing it 🙂. To do that, use:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'your_custom_woocommerce_template_single_meta', 40 );
function your_custom_woocommerce_template_single_meta() { //custom code}
How to bulk change product data in WooCommerce
By default, WooCommerce lets you update the product data fast with a Quick Edit/ Edit option on the Products screen.
If you’re interested in bulk updating product data or importing products to WooCommerce, I want to give you one more tip 😀. Use our free WooCommerce Product importer plugin to import and update products in minutes!
Download the free plugin!
Dropshipping Import Products for WooCommerce
Import and synchronize wholesale products with WooCommerce products. Add margin to the prices of imported products. Use conditional logic. Make your work easier.
💾 Active Installations: 1,000+ | WordPress Rating:
Summary
Today, I’ve shown you how to hide products, product categories, and specific product data on the WooCommerce product page.
If you have any questions about hiding the category or our product importer plugin for WooCommerce leave a comment below 🙂.
Finally, I encourage you to read our blog posts, for example, about WooCommerce shortcodes, WooCommerce SEO, or WordPress design and development 🎉!