WooCommerce Brands: display brand description on product page

WooCommerce has a very good add-on called “WooCommerce Brands” to help you link products to brands. This plugin provides a huge list of shortcode and builtin functions to display pretty much everything everywhere. However, I’d like to share a little very useful snippet to automatically display the brands description on the product page itself, below the product description.

To do so, I simply created a little function that I hooked to the woocommerce_single_product_summary action. The code I propose is very simple and could be improved pretty easily, but I just want to provide the basics. Then it’s up to you to make something truly awesome with that snippet! And if you do, please write a comment to share your improvements!

Place the following snippet in functions.php in your theme folder (in wp-content/themes/your-theme-folder).

6 responses to “WooCommerce Brands: display brand description on product page”

  1. howlingweb

    Hi Remy, thanks for all your help so far.

    I want to be able to show the brand name in my home page template just below the title of the product. Its proving difficult.

    How would I add the brand name to the code below?

    ‘product’,
    ‘stock’ => 1,
    ‘posts_per_page’ => 4,
    ‘orderby’ =>’date’,
    ‘order’ => ‘DESC’ );

    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>

    <a id="id-” href=”” title=””> php – Woocommerce product variations, Google product …

    post->ID )) echo get_the_post_thumbnail($loop->post->ID, ‘shop_catalog’); else echo ”; ?>

    <!– ID, ‘_location’, true ); ?> –>
    get_price_html(); ?>

  2. nicksarr1

    Added this to my Functions.php, but no change. Is there another step other than just adding this code there?

  3. johnno

    Thanks for the snippet, worked perfectly – Really need to figure out how to truncate the brand description for my product page though – to around 50 characters… just like the_excerpt. Any tips?

  4. cglaudel

    Bonjour Rémy.
    Evreythings works, but (the current site is in french) so If I change echo __( ‘Brand Description’, ”) . ‘ : ‘ by echo __( ‘Auteur’, ”) . ‘ : ‘ I get what I need BUT if I use WPML to translate What will Happen? or another question What .po/.mo file I have to create or modify to change this string that is in the child theme function? Do I have to copy paste this function in the divi original function file, then parse the folder with PoEdit charged with the original fr_FR.po file of divi that maybe will add this string ? So that may work after I will suppress this lines from the didi file? do the .mo file will point to the correct string after ?
    Thanks for your answer. Christophe

  5. cglaudel

    Another question : How do I could have a link to the brand page with your code ? How do you change the echo line to get the ability to display all the products relative to that brand ? and question CSS : how to give a class to this string ?
    Yours
    Christophe

  6. cglaudel

    Hello. As I wrote formerly the code Brand description systematically add a carrier return (retour chariot) before to display the content of the field. If you want to display just the brand name there is
    Another code here is to display solely the band name below the short description in the single product page :
    I add a div and a call to css class called brand-name but you can change that or suppress the div code lines if you dont want
    /* —————————————————– */
    /* – BRANDS name in single product page – */
    /* —————————————————– */
    /**
    * woocommerce_brand_name
    */
    add_action( ‘woocommerce_single_product_summary’ , ‘woocommerce_brand_name’, 25 );
    function woocommerce_brand_name() {
    global $post;
    $brands = wp_get_post_terms( $post->ID, ‘product_brand’, array(“fields” => “all”) );
    foreach( $brands as $brand ) {
    echo ”;
    echo __( ‘Auteur’, ”) . ‘ : ‘ . $brand->name;
    echo ”;
    }
    }
    add_shortcode( ‘brand_name’, ‘woocommerce_brand_name’ );

    and the shortcake to display it.

Leave a Reply