I don’t know of a direct method to achieve this, you should be able to get the category count using get_term
then subtract that from the total.
function product_count_shortcode( $atts ) {
$data = shortcode_atts( array(
'cat_id' => 144,
'taxonomy' => 'category'
), $atts );
$category = get_term( $data['cat_id'], $data['taxonomy'] );
$count = $category->count;
$count_posts = wp_count_posts( 'product' );
return (int)$count_posts->publish - (int)$count;
}
add_shortcode( 'product_count', 'product_count_shortcode' );
From iguanarama answer:
You can also use WP_Query
$myQuery = new WP_Query ([
'post_type' => 'product',
'cat' => '-144',
'post_status' => 'publish'
]);
$count = ($myQuery ? $myQuery->found_posts : 0);