Reply 220651 to: Brands under products

Avatar: Rose Tyler
Rose Tyler
Support staff
September 4, 2019 at 08:07

Hello,

You can disable categories from the shop grid via Theme Options > WooCommerce (Shop) > Shop > Products style > Product Content Elements > http://prntscr.com/p1jx2y
Or you can set “Primary category” that will be shown on the grid – http://prntscr.com/p1jxr2
To display brands you can add this code in functions.php file of the child theme:

add_action('woocommerce_after_shop_loop_item_title', '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_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

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.