I did it when I use shortcode for both single product and brands in loop:
function show_brands_in_loop(){
if( $brands_in_loop !== ‘brand_link’ || $brands_in_loop !== ‘brand_image’ ){
$brands_in_loop == ‘brand_image’;
global $product;
$brands = get_the_terms( $product->ID, ‘pwb-brand’);
foreach( $brands as $brand ){ ?>
<div class=”pwb-brands-in-loop <?php echo $brand->slug;?>”>
<?php echo do_shortcode(‘[pwb-brand]’); ?>
</div>
<?php
}
}
}
add_action( ‘woocommerce_after_shop_loop_item_title’, ‘show_brands_in_loop’, 6 );
and for single product:
function undrwr_sp_brand(){
global $product;
$brands = get_the_terms( $product->ID, ‘pwb-brand’);
foreach( $brands as $brand ){ ?>
<div class=”pwb-single-product-brands pwb-clearfix <?php echo $brand->slug;?>”>
<?php echo do_shortcode(‘[pwb-brand]’); ?>
</div>
<?php
}
}
add_action( ‘woocommerce_single_product_summary’, ‘undrwr_sp_brand’, 6 );
but I disabled both in admin options do prevent double rendering but because of
if( $brands_in_loop == ‘brand_link’ || $brands_in_loop == ‘brand_image’ ){
its not showing on shop page loop ??