Skip to content

Instantly share code, notes, and snippets.

Avatar

movielady movielady

  • South Dakota, USA
View GitHub Profile
@movielady
movielady / woocommerce-hide-empty-categores.php
Created Dec 30, 2020 — forked from cklosowski/woocommerce-hide-empty-categores.php
Here's a quick function that will look at the categories in the product list, find the products in the category, and if none of the products are visible, it will not display the category in the widget: https://chrisk.io/woocommerce-hide-categories-with-no-visible-products-in-the-product-category-widget/
View woocommerce-hide-empty-categores.php
<?php
/**
Plugin Name: WooCommerce - Exclude empty categories from widget
Plugin URI: https://chrisk.io/woocommerce-hide-categories-with-no-visible-products-in-the-product-category-widget/
Description: Excludes categories with no visible products from the WooCommerce category list
Version: 0.1
Author: Chris Klosowski
Author URI: https://chrisk.io
*/