skip to Main Content
WooCommerce: How To Show Empty Categories

2018-01-30: The solution to this for WooCommerce 3.x+ needs to be updated for screenshots only. WooCommerce moved the product display options to the Customizer under “WooCommerce”. I’ll be working to get this post and the plugin’s instructions updated.

2017-08-10: Created a plugin. View details here.

2017-07-17: Updated this post for WooCommerce 3.x compatible code.

The main action, woocommerce_product_subcategories_hide_empty, changed its behavior to act more inline with how it was named.

Request

Show empty categories on product pages and/or shop pages using WooCommerce

Required Plugins

Code for WooCommerce 3.x+

Place the following in your functions.php file of your theme:

Pre 3.x Code

Place the following in your functions.php file of your theme:

WooCommerce Settings

Go to WooCommerce Settings Product Tab and change one or both of the “Shop Page Display” and “Default Category Display” to “Show subcategories” or “Show both”

Image: WooCommerce settings page showing dropdown for Shop Page Display

Result

Before code is applied the empty “mints” top category isn’t displayed on the shop page.

Image: Showing the display of WooCommerce categories before the code is applied

After the code is applied the mints category is now displayed.

Image: WooCommerce display of categories after this code example is applied.

Disclaimer

Maje Media LLC cannot be held responsible for the functionality of this code. Please make sure you test it on a development site before adding the code to your production website. There is no support available for this (and other) code snippet(s) posted on this website. If you’d like Maje Media to do custom development to help with your custom implementation please send a contact request.

This Post Has 4 Comments
    1. isaiaiah,

      Thanks for the comment. We’ve updated the post to work correctly now in the post-3.x WooCommerce world.

  1. Hey! This is Aj the creator of the Total theme. I was looking for the code to quickly give to a customer and you guys showed up first on Google. Cool 😉 I’m happy to see you are still using the theme after many years. You’ve got a lot of nice content on your blog – I’ve been browsing a round and having a read.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top