How i can show Brand on single product page and shop page?

This topic has 13 replies, 2 voices, and was last updated 7 years ago ago by Rose Tyler

  • Avatar: IvanRyz
    IvanRyz
    Participant
    October 25, 2017 at 00:46

    Hello! How i can show Brand on single product page and shop page?
    Thanks!

    12 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 25, 2017 at 09:37

    Hello,

    You may add Brands widget in Shop page sidebar or Single product page Sidebar (Appearance > Widgets).

    Regards

    Avatar: IvanRyz
    IvanRyz
    Participant
    October 25, 2017 at 09:52

    i mean i need shortcode or action . Check attachment pls
    https://prnt.sc/h1qg44

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 25, 2017 at 10:00

    You may use [brands] shortcode.
    If you plane to edit single product page in files, make changes in the child theme to prevent losing them after theme update.

    Regards

    Avatar: IvanRyz
    IvanRyz
    Participant
    October 26, 2017 at 13:43

    if i use [brands] shortcode, i see all brans on the page. but i need show product brand on single product page.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 26, 2017 at 13:53

    Try to enable sidebar on single product page, by default brand will be shown here.

    Regards

    Avatar: IvanRyz
    IvanRyz
    Participant
    October 26, 2017 at 14:12

    I need show product brand like screenshot
    https://prnt.sc/h2a689

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 26, 2017 at 14:32

    In this case, you may add this code in function.php file of your child theme:

    add_action('woocommerce_single_product_summary', 'et_print_brands', 10);
    
    function et_print_brands(){
    
        global $post, $product;
        $terms = wp_get_post_terms( $post->ID, 'brand' );
    
        if(count($terms)>0) {
            ?>
    			<p>Brands: 
                <?php
                    foreach($terms as $brand) {
                        $image          = '';
                        $thumbnail_id   = absint( get_woocommerce_term_meta( $brand->term_id, 'thumbnail_id', true ) );
                        ?>
                        <a href="<?php echo get_term_link($brand); ?>">
                            <?php
                                echo $brand->name;
                            ?>
    
                        </a>
                        <?php
                    }
                ?>
    
                </p>
    				
            <?php
        }
    }

    Regards

    Avatar: IvanRyz
    IvanRyz
    Participant
    October 26, 2017 at 15:15

    Great Thanks

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 26, 2017 at 15:21

    You’re welcome!

    Regards

    Avatar: IvanRyz
    IvanRyz
    Participant
    October 26, 2017 at 19:00

    and i need show brands on shop page can you check pls screenshot https://prnt.sc/h2ecxx

    Avatar: IvanRyz
    IvanRyz
    Participant
    October 26, 2017 at 19:02

    no prob i add action woocommerce_after_shop_loop_item_title. Thank you!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 27, 2017 at 07:33

    Hello,

    I am glad that you sorted out.

    Regards

  • Viewing 13 results - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.