I don’t know about you, but I have had clients using WooCommerce to sell things other than physical products. For instance, one client is using it to sell tickets to events. In this case, having a tab named “Product Description” just isn’t quite…right. Additionally, the header within the box is often just redundant.

Here I provide you with code to make several different types of changes to this part of your WooCommerce installation. Each of these snippets would be placed within the functions.php file of your theme.

To just change the title of the tab to something specific for every instance of this tab, use this:

// Change the description tab title to Event Information
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'] = 'Event Information';
return $tabs;
}

To change the tab title to the title of the product itself (this would change with each product being viewed), use this:

post_title;
return $tabs;
}

You could also change the header title to reflect the product name. In that case, use this code:

// 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;
}
?>

Another variation would be to set it as a consistent header throughout, but with different default text. Here’s how you would do that:

// 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 'Event Details';
}
?>

Or if you want to remove the header altogether, try this:

// Change the description tab heading to something specific
add_filter('woocommerce_product_description_heading',
'isa_product_description_heading');

function isa_product_description_heading() {
    return '';
}

I hope these options are helpful to you. If you have any questions or suggestions, or if this has helped you, please comment below.

thePixelPixie.com - WordPress boutique

Subscribe and receive my FREE eBook


4 MISTAKES You’re Making on Your Website that are Costing You MONEY!

  • This field is for validation purposes and should be left unchanged.

The Author

Save

2 responses to “Adding WooCommerce Product Categories & Products to Your Menu”

  1. Hi. Thanks for this. It’s very useful.

    Is there a way to modify this one so that HTML tags in the title are not encoded into entities?

    // 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;
    }
    We’re using italics in some product titles, which generally works fine in most places, except this function where they are encoded into their HTML entities, and thus the italic tags are shown.

    Thanks,
    Michael

    • Hi Michael,
      I apologize for not seeing your comment before now. Unfortunately, I’m afraid I don’t have an answer for you. But I’m going to look into it for you and see if I can find an answer. That said, if you’ve already come up with an answer, I’d love to know your solution!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ready to chat about how ThePixelPixie can help?