By default, empty WooCommerce product categories (i.e. categories which have no published products) will not display on your Shop page.

This makes a lot of sense and avoids that customers land on empty pages… BUT sometimes you might have different needs and require that users still see these categories when the shop display is set to “Show Categories”.

Thankfully there is a quick one-line fix that you can copy / paste in your functions.php to show empty categories… enjoy!

Display empty categories @ WooCommerce Shop page

PHP snippet: Show Empty WooCommerce Product Categories

/**
 * @snippet       Show Empty Categories @ Shop Page
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_product_subcategories_hide_empty', '__return_false' );

PHP snippet (Storefront Theme): Show Empty WooCommerce Product Categories @ Homepage

/**
 * @snippet       Show Empty Categories @ Homepage
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'storefront_product_categories_shortcode_args', 'bblomer_storefront_homepage_show_empty_cats' );

function bblomer_storefront_homepage_show_empty_cats( $args ) {
  $args['hide_empty'] = 0;
  return $args;
}
Share:

Leave a Reply