If you want to display brand name and brand description on single page than first create custom textonomy “brand” on woocommerce product than create some brand of product after that Add/Edit product and select brand, which you want and save/update product. So your brand is added in single product.
Add below line of code in your theme’s functions.php file of your active child theme (or theme). so your brand and brand description are display on single product page.
add_action( 'woocommerce_single_product_summary' , 'woocommerce_brand_detail', 25 ); function woocommerce_brand_detail() { global $post; $brands = wp_get_post_terms( $post->ID, 'custombrandnonhierarchical', array("fields" => "all") ); // Insted of 'custombrandnonhierarchical' used your "brand" slug which will get in url when you click on dashboard > products > brand. foreach( $brands as $brand ) { echo __( 'Product Brand Name', '') . ': ' . $brand->name .' '; echo __( 'Brand Description', '') . ': ' . term_description( $brand->term_id, 'custombrandnonhierarchical' ); } }
You must be logged in to post a comment.