WooCommerce Product Title as Description Tab title and heading

So as promised I will do a lot more posts on this blog and to kick things off I am doing a snippet on how to change the WooCommerce single product description tab title and heading to that of the product name instead of just saying Description.

To change the WooCommerce Single Product Description tab title and heading to the product name, place the following PHP code in your theme’s functions.php file


<?php
// Change the description tab title to product name
add_filter( 'woocommerce_product_tabs', 'wc_change_product_description_tab_title', 10, 1 );
function wc_change_product_description_tab_title( $tabs ) {
global $post;
if ( isset( $tabs['description']['title'] ) )
$tabs['description']['title'] = $post->post_title;
return $tabs;
}
// Change the description tab heading to product name
add_filter( 'woocommerce_product_description_heading', 'wc_change_product_description_tab_heading', 10, 1 );
function wc_change_product_description_tab_heading( $title ) {
global $post;
return $post->post_title;
}
?>

view raw

functions.php

hosted with ❤ by GitHub