php – Woocommerce. Check if product belong to specific main category

I wnat to display custom template for produts belongs to specific main category. My category tree is like this:

Beer

My code in single-product.php is:

if( has_term( 'beer', 'product_cat' )) {
  wc_get_template_part( 'single-product-beer' ); 
} else {
  wc_get_template_part( 'single-product-default' );
}

This works fine only if product has “beer” category. But if it is IPA or another child category dont work. How to modify this code to work propertly? (with child categories).