How to remove woocommerce tab?

user1724434 picture user1724434 · Jun 12, 2015 · Viewed 23.7k times · Source

the products in our woocommerce shop don't need any of the default tabs so I have managed to disable them being that I only need to have the product description below the product however, while I want to keep the actual description, I believe the tab itself is redundant since there aren't any other tabs.

Basically, I want to remove the tab's & title altogether but keep the content box below it without modifying the woocommerce core php template file. Is there a way to add a filter to my WordPress theme's functions.php?

function woocommerce_default_product_tabs( $tabs = array() ) {
    global $product, $post;

    // Description tab - shows product content
    if ( $post->post_content ) {
        $tabs['description'] = array(
            'title'    => __( 'Description', 'woocommerce' ),
            'priority' => 10,
            'callback' => 'woocommerce_product_description_tab'
        );
    }

Answer

scottdurban picture scottdurban · Apr 29, 2016

While CSS is great, if the stylesheet doesn't load correctly, you could end up showing someone tabs without meaning to. It is best to remove the content before loading (server side), by using a filter, as you had mentioned.

See code below as provided from Woothemes for unsetting data tabs.
EDIT Place within the functions.php file inside your theme.

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {
    unset( $tabs['description'] );          // Remove the description tab
    unset( $tabs['reviews'] );          // Remove the reviews tab
    unset( $tabs['additional_information'] );   // Remove the additional information tab
    return $tabs;
}

EDIT As noted by @BasvanDijk To remove altogether, you can use the following

add_filter( 'woocommerce_product_tabs', '__return_empty_array', 98 );