I'm trying to show/hide two lines of text depending on whether a WooCommerce category is empty or has any products in it. Those lines are inserted in text blocks using Elementor and I've assigned a CSS #ID to each one, so I can control it.
Now, in a custom functions plugin I have, I want to add a function to control what phrase to hide using a css rule of the type: display:none;. The code I have now is:
function show_outlet_msg($content){
$term = get_term( 40, 'product_cat' );
$total_products=$term->count;
if ($total_products>0){
//Have a products
} else {
//No products
}
}
add_filter('astra_entry_content_before','show_outlet_msg');
Now I would like to apply that if there are products in Outlet, the text that there are no products in Outlet should be hidden:
#txt_outlet_zero{
display: none;
}
And in case there are no products, hide the one that says there are:
#txt_outlet_head{
display: none;
}
How can I apply these CSS rules from the php code?