Mailchimp Banner | Q2 2024

added by Latoya

Product Icon

WooCommerce Brands

by  Woo
Create, assign and list brands for products, and allow customers to view by brand.

Display Brand Name as a link in catalogue product page

Improve this code:

<?php
if ( is_plugin_active( 'woocommerce-brands/woocommerce-brands.php' ) ) {
add_action( 'woocommerce_shop_loop_item_title', 'add_brands_to_product_loop' );
// Add brands to product loop.
function add_brands_to_product_loop() {
$terms = get_the_terms( get_the_ID(), 'product_brand' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$term = join( ', ', wp_list_pluck( $terms, 'name' ) );
echo esc_html( $term );
}
}
}

Author

Sevun

Current Status

Open

Last updated: August 24, 2023

0 comments

Log in to comment on this feature request.