Q:

Woocommerce | Display text on a single brand page

I want to display text on a single brand page on Woocommerce. 
I wrote this snippet on my functions.php but it doesn't seem to work:
function woo_brand_page_check() {

  $brands = wp_get_post_terms( $post->ID, ‘product_brand’, array("fields" => "all") );

    if (is_tax( 'product_brand' )) {
      foreach( $brands as $brand ) {
        if($brand == 'BRAND_NAME') {
          echo 'Custom text ';
        }
      }
    } else {
        echo '';
    }

}
add_action('woocommerce_before_shop_loop', 'woo_brand_page_check');

If you have any suggestions on how to implement this, please drop me a line!
Thanks in advance! 

A:

If your Brands are product attributes, the taxonomy should be automatically prefixed with 'pa_', so you should use pa_product_brand.
Double check if product_brand has a dash in place of the underscore (as usually happens), so it would become pa_product-brand
Also, you may parr the term in is_tax() instead of looping all terms, something like:
function woo_brand_page_check() {

  if ( is_tax( 'pa_product_brand', 'BRAND_NAME' ) ) {
    echo 'Custom text ';
  }

}
add_action('woocommerce_before_shop_loop', 'woo_brand_page_check');

See: https://codex.wordpress.org/Function_Reference/is_tax
Cheers ;)

