Using has_term() function for category-subcategory structure

Reading this solution here:
has_category() for parent category

I tried a similar approach and instead of hammering down all the terms I utilized the above solution to leverage the category term or any of its sub-categories:

add_filter('the_content', 'ssws_add_content');
function ssws_add_content($content) {

    $cat_id   = get_cat_ID('accommodations');
    $children = get_term_children($cat_id, 'category');

    $ssws_custom_text="<h1>Accomodation</h1>";

    if (is_single() && (has_category($cat_id) || has_category($children))) {
        $content .= $ssws_custom_text;
    }

    return $content;

}