Skip to content

Instantly share code, notes, and snippets.

@ibndawood
Created January 30, 2019 08:37
Show Gist options
  • Save ibndawood/105fbb4797bc1e10395bf1bd105e0f0c to your computer and use it in GitHub Desktop.
Save ibndawood/105fbb4797bc1e10395bf1bd105e0f0c to your computer and use it in GitHub Desktop.
Electro v2 - Show brand name in product loop
add_action( 'woocommerce_shop_loop_item_title', 'ec_template_loop_product_brand', 41 );
function ec_template_loop_product_brand() {
global $product;
$product_id = electro_wc_get_product_id( $product );
$brands_tax = electro_get_brands_taxonomy();
$terms = get_the_terms( $product_id, $brands_tax );
$brand_name = '';
if ( $terms && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
$brand_name .= $term->name ;
}
}
if ( ! empty( $brand_name ) ) : ?>
<div class="brand">
<?php echo wp_kses_post( $brand_name ); ?>
</div>
<?php endif;
}
@ibndawood
Copy link
Author

@Bocsek
Copy link

Bocsek commented Feb 24, 2021

Thanks for your help, I've just emailed the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment