• Resolved newhappyrabbit

    (@newhappyrabbit)


    Hello, I’ve been trying to create a banner with the brand logo and description under the product in the single product page, but can’t find a way to get the brand description. I’ve looked through the code, found how it’s called in the brand catalog page and tried using it but to no success.

    EDIT:
    I’ve found this thread: https://wordpress.org/support/topic/how-can-you-get-the-brand-onto-the-shop-pages/

    I will try to run this code when I get to work and will update the thread later:

    
    global $product;
    
    $product_brand = get_the_terms( $product->get_id() , 'yith_product_brand');
    
    echo $product_brand->description 
    
Viewing 1 replies (of 1 total)
  • Thread Starter newhappyrabbit

    (@newhappyrabbit)

    I was on the right path, will explain solution below:

    <?php
    // THE IF IS OPTIONAL!! It checks if the url contains 'wp-admin'
    //if true, it doesn't run the code, because while using Elementor, if the code is ran it throws errors and doesn't let me inside the editor
    if (strpos($_SERVER['REQUEST_URI'],'wp-admin') === false) {
        global $product;
        $product_brand = get_the_terms( $product->get_id() , 'yith_product_brand');
        echo $product_brand[0]->description; //had to use [0], because get_the_terms returns an array
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to print brand description’ is closed to new replies.