require_once() if a product in woocommerce contains a tag [closed]

has_term() is a template function therefore it does not work if you use it straight in functions.php which is loaded well before knowing if the current object is a product page.
So if you use it in functions.php you could do:

add_action('template_redirect','my_inclusion_function');
function my_inclusion_function(){
  if(is_product() && has_term('xyz', 'product_tag')){
    require_once( WP_CONTENT_DIR.'/path/file.php');
  }
}

is_product() checks if you are in a single product and then if the product has tag xyz

If the inclusion has layout implications such as print additional information or so, then this approach is not ideal since the inclusion occurs at the very beginning of the content jsut after the <body> tag opening. In this case you can just modify the single-product.php template file (as suggested in the comment by tiago calado)

Also you can use one of the available hooks in the single-product page check this useful resource and use it directly in functions.php. The advantage of this last approach is that you don’t have to review the layout pages in case of future theme switch.