Website Building » WooCommerce » How Do I Hide Blank Categories in WooCommerce?

How Do I Hide Blank Categories in WooCommerce?

Last updated on January 19, 2023 @ 1:11 pm

There are a few different ways that you can hide blank categories in WooCommerce. One way is to simply go to the Settings page in your WordPress admin area and select the “hide empty terms” option. This will remove any terms that don’t have any products assigned to them from your front-end shop pages.

Another way to achieve this is by using a plugin liketerm_image_url] Blank Category Fix for WooCommerce. This plugin will add a piece of code to your site that will automatically hide any empty terms.

PRO TIP: If you are using a WooCommerce plugin and want to hide blank categories, be aware that this may break some features of your site. For example, if you have products in those categories, they will no longer be displayed on your site. Additionally, any links to those categories will also be broken.

You can also achieve this by adding some code to your site. If you’re comfortable with editing code, you can add the following snippet to your theme’s functions.php file:

add_filter( 'woocommerce_product_categories_widget_args', 'bbloomer_hide_empty_terms' );
 
function bbloomer_hide_empty_terms( $args ) {
$args['hide_empty'] = true;
return $args;
}
Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.