Woocoomerce product category count including subcategories
WP_Query can be used to determine the number of posts contained within a category and its subcategories. In the code below, set the terms parameter to whatever the parent category ID is. The include_children parameter ensures that WP_Query will include posts within subcategories. We can then use $query->post_count to get the total number of posts … Read more