[Woocommerce] Mostrar marca del producto

<?php function reha_single_product_brand(){ $has_brand = get_the_terms( get_the_ID(), 'product_brand' ); if($has_brand) { echo "<div class=\"brand-navigation\">"; foreach ($has_brand as $brand){ $brand_thumb_id = get_field('brand-image', $brand); if($brand_thumb_id){ ?> <a href="<?php echo esc_url( get_term_link( $brand ) ); ?>" title="<?php echo esc_attr($brand->name); ?>"><?php echo wp_get_attachment_image( $brand_thumb_id, array(150, 100), false, array('alt'=>trim(strip_tags($brand->name))) ); ?></a> <?php } } echo "</div>"; } } add_action('woocommerce_single_product_summary', 'reha_single_product_brand', 11); ?>
Action de woocommerce que permite mostrar las marcas asociadas a un producto, justo debajo del titulo del producto.

*Requiere tener el plugin de ACF (Advanced Custom Fields), para añadir un campo que se la imagen, y poder mostrarla.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.