• Hi want to show a link to another internal page if current brand name is KB. Tried the code above but it doesnt work.

    function brands_on_single_product_page() {
    global $product;
    $brands = get_the_terms( $product->get_id() , 'yith_product_brand');
    foreach( $brands as $brand ) {
    	if($brand->name == 'KB') {
              echo 'link to somewhere ';
        }
        }
    }
    add_action('woocommerce_single_product_summary', 'brands_on_single_product_page', 30);
    • This topic was modified 2 years, 12 months ago by Teet Bergmann.
Viewing 1 replies (of 1 total)
  • Thread Starter Teet Bergmann

    (@teetb)

    OK solved it myself ??

    function brands_on_single_product_page() {
    global $product;
    $brands = get_the_terms( $product->get_id() , 'product_brand');
    foreach( $brands as $brand ) {
    if($brand->name == 'KB') {
    echo 'link to somewhere ';
    }
    }
    }
    add_action('woocommerce_before_add_to_cart_form', 'brands_on_single_product_page', 6);
    • This reply was modified 2 years, 12 months ago by Teet Bergmann.
Viewing 1 replies (of 1 total)
  • The topic ‘How to show custom link if specific brand’ is closed to new replies.