Reply 305797 to: Categories above the product name

Avatar: Olga Barlow
Olga Barlow
Support staff
October 18, 2021 at 19:44

Hello,

There is no such option. But you may try to use WooCommerce hooks to implement this by additional customization.
For example, add the below code to child theme functions.php

function custom_single_product_category(){
    $product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' );
    if ( $product_cats && ! is_wp_error ( $product_cats ) ){
        $single_cat = array_shift( $product_cats ); ?>
        <h2 itemprop="name" class="product_category_title"><span><?php echo $single_cat->name; ?></span></h2>
<?php }
}
add_action( 'woocommerce_single_product_summary', 'custom_single_product_category', 2 );

Regards

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.