The WooCommerce “products” shortcode displays all products in your shop. There is even an attribute called “category” where you can specify comma-separated list of category slugs in order to further filter the output.
What you can’t do is define a list of unwanted categories (think of “uncategorized” for example) i.e. a list of categories you want to exclude from the products shortcode output.
So, here’s the fix, enjoy!
WooCommerce: exclude category from shortcodes
PHP Snippet: Exclude Category from “products” Shortcode
Let’s say we want to remove the category “black” (see above example) from the “products” shortcode. The snippet to place in your functions.php is very simple: