• Resolved randomwpuser

    (@randomwpuser)


    I have a woocommerce store and I want to display the product brand in the product box. I have read many topics on stack overflow and tried many suggested solutions as you can see here:

    
    echo "<strong>BRAND: ";
    /*foreach ( $brands as $key => $brand ) :
        echo $brand->name;
    endforeach;
    echo "</strong><br/>";*/
    $product_id  = get_the_id();
    $product     = wc_get_product( $product_id );
    
    $taxonomy    = <code>product_tag</code>;
    $brand_names = wp_get_post_terms( $product_id, $taxonomy, array( 'fields' => 'names' ) );
    
    // Get the brand name
    $brand_name = reset( $brand_names );
    
    echo $brand_name;
    echo "</strong><br/>";
    

    In my database in the wp_term_taxonomy table one of my brands get the taxonomy as ‘product_tag’:
    https://i.stack.imgur.com/VAbfZ.png

    These solutions didn’t work for me, the result comes back empty, and if i use “product_tag” as my parameter, only actual tags are shown. How can i display the product brand in front of product name in the product box in shop list?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Product brand in productbox’ is closed to new replies.