How to search through all child taxonomies using WP_Query?

Finally figured out the solution. Answering it if anyone finds it useful. Where $_GET['s_qr'] has a search query from a user from another page.

    $i = 0;
    $parent_name="";
    $taxonomyName = "product-cat";
    $search_r = array();
    $parent_terms = get_terms( $taxonomyName, array( 'parent' => 0, 'orderby' => 'slug', 'hide_empty' => false ) );   

    foreach ( $parent_terms as $pterm ) {
        $parent_name_1 = $pterm->name;
        $terms = get_terms( $taxonomyName, array( 'parent' => $pterm->term_id, 'orderby' => 'slug', 'hide_empty' => false ) );
        foreach ( $terms as $term ) {
            //Find if the the category name has the search query
            if (stripos($term->name, $_GET['s_qr']) !== false) {
                $search_r['item'][$i] = $term->name. " in ".$parent_name_1;   
                $i++;
            }
        }
    }
    print_r($search_r);