Shaf
Shaf

Reputation: 121

Rename Description tab in Woocommerce single product page

I pasted this code in function.php, but it didn't rename the product page tab as it supposed to (http://www.noushasasart.com/product/harsh-bark/)

function woo_remove_product_tabs($tabs) {
    unset($tabs['reviews']);    // Remove the reviews tab
    $tabs['description']['title'] = __('Additional Information');  // Rename the 

    description tab        
    return $tabs;
}

how can I solve this?

Upvotes: 3

Views: 5745

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253773

You have forgotten the filter hook:

add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {

    unset($tabs['reviews']);    // Remove the reviews tab

    $tabs['description']['title'] = __( 'More Information' ); // Rename the description tab

    return $tabs;
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

All code is tested on Woocommerce 3+ and works.


Update (related to your comment) | Rename product description heading (inside the tab):

To rename description heading use woocommerce_product_description_heading filter hook this way:

add_filter( 'woocommerce_product_description_heading', 'rename_product_description_heading', 10, 1 );
function rename_product_description_heading( $heading ) {
    return  __( 'Additional Information', 'woocommerce' );
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

All code is tested on Woocommerce 3+ and works.


Official related documentation: Editing product data tabs

Upvotes: 6

Related Questions