Only return taxonomies that are linked to a category & product

This will find all terms in custom taxonomy underkategorier and then will show terms with post from chosen category.

$taxonomies = get_taxonomies(array('name'=>'underkategorier'),'object'); 

foreach($taxonomies as $taxonomy) {
    $terms = get_terms( $taxonomy->name, 'orderby=count&hide_empty=0' );
    foreach($terms as $term) {
        $wpq = array ('taxonomy'=>'underkategorier','term'=>$term->slug, "cat"=>10);
        $myquery = new WP_Query ($wpq);
        $article_count = $myquery->post_count; 
        echo $term->name.' '.$article_count; //with empty ones
        if ($article_count){
            echo "<ul>";
            echo "<li>".$term->name.' '.$article_count."</li>";
            echo "</ul>";
        }
    }
}