function wp_get_productcat_postcount($id) {
//return $count;
$args = array(
'post_type' => 'product', //post type, I used 'product'
'post_status' => 'publish', // just tried to find all published post
'posts_per_page' => -1, //show all
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat', //taxonomy name here, I used 'product_cat'
'field' => 'id',
'terms' => array( $id )
)
)
);
$query = new WP_Query( $args);
/*
echo '<pre>';
print_r($query->post_count);
echo '</pre>';
*/
return (int)$query->post_count;
}