am trying to add product category to the product title using this code on functions.php on child theme but its not working the way i want, please check the attached image:
remove_action( ‘woocommerce_single_product_summary’,’woocommerce_template_single_title’, 5 );
add_action( ‘woocommerce_single_product_summary’, ‘custom_product_category_title’, 6 );
function custom_product_category_title(){
global $post;
$terms = get_the_terms( $post->ID, ‘product_cat’ );
$title = ”;
foreach ($terms as $term) {
$title = $term->name .’ ‘;
}
echo “<h1 class=’product_title entry-title’>”.$title.”</h1>”;
}
any advice would be great!
sorry, but your support is expired so we can't provide any customization help