I’m not sure if you can add styles in filters.
I tested the below code in wp_head action and worked perfectly:
function show_outlet_msg(){
$term = get_term( 40, 'product_cat' );
$total_products=$term->count;
if ($total_products>0){
$html="<style> #txt_outlet_zero{ display: none; } </style>";
} else {
$html="<style> #txt_outlet_head{ display: none; } </style>";
}
echo $html;
}
add_action('wp_head','show_outlet_msg');