Can i add brand logo on the product thumbnail grid?

This topic has 4 replies, 3 voices, and was last updated 4 years, 6 months ago ago by Rose Tyler

  • Avatar: Sayeed
    Sayeed
    Participant
    June 17, 2021 at 16:10

    Is there any possible way to add brand logo on the product thumbnail grid?
    I know I have to hand down on a code? can you please tell me which file?

    There is an example of what I want: https://i.imgur.com/Q577trR.jpg

    3 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Participant
    June 18, 2021 at 11:12

    Hello,

    Add the below code to child theme functions.php

    add_action('woocommerce_before_shop_loop_item', 'eth_product_brand_image');
    function eth_product_brand_image() {
    	global $post;
    	$terms = wp_get_post_terms( $post->ID, 'brand' );
    	?>
        <div class="sidebar-widget product-brands">
            <h4 class="widget-title"><span><?php esc_html_e( 'Product brand', 'xstore' ) ?></span></h4>
    		<?php
    		foreach ( $terms as $brand ) {
    			$thumbnail_id = absint( get_term_meta( $brand->term_id, 'thumbnail_id', true ) );
    			?>
                <a href="<?php echo get_term_link( $brand ); ?>">
    				<?php if ( $thumbnail_id ) :
    					echo wp_get_attachment_image( $thumbnail_id, 'full' );
    				endif; ?>
                </a>
    			                    
    			<?php
    		}
    		?>
        </div>
    	<?php
    }

    Regards

    Avatar: Sayeed
    Sayeed
    Participant
    June 18, 2021 at 15:40

    Thanks, Olga Barlow 🙂

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 19, 2021 at 16:01

    Hello Sayeed,

    We’d appreciate if you could take a moment to give us 5-stars on ThemeForest! https://themeforest.net/downloads

    Regards

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

The issue related to '‘Can i add brand logo on the product thumbnail grid?’' has been successfully resolved, and the topic is now closed for further responses

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