I'm looking for a way to make a conditional rule that checks, in a category archive template, if the current category has any subcategories with posts.
More specifically, the posts are "products" in a Woocommerce setup.
So far I was only able to check if the current category has subcategories with the code below. But even after some searching I wasn't able to advance any further.
$term = get_queried_object();
$children = get_terms( $term->taxonomy, array(
'parent' => $term->term_id,
'hide_empty' => false
) );
if($children) {
echo 'something';
}