Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove woocommerce tab?

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'
        );
    }
like image 404
user1724434 Avatar asked Jun 12 '15 20:06

user1724434


People also ask

How do I change the tab in WooCommerce?

To create Saved Tabs, go to Settings > Custom Product Tabs for WooCommerce. Click on the Add New button to create a new Saved Tab. Enter a title and fill the content for this new Saved Tab. Then click on the Save Tab button.

How do I change the Additional Info tab in WooCommerce?

Install and activate the WooCommerce Tab Manager plugin. Once the plugin is activated, go to WooCommerce > Tabs. On this page, you'll see a list of all the default tabs as well as any custom tabs that you've created. Find the tab labeled “Additional Information” and click on the Edit link.

How do I hide tags in WooCommerce?

One way is to simply remove the tabbed interface altogether by going to the WooCommerce Settings page and selecting the “Disable the default tabs” option. This will remove all of the tabs from the product page, including the “Description”, “Additional Information”, and “Reviews” tabs.


1 Answers

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 );
like image 69
scottdurban Avatar answered Sep 24 '22 02:09

scottdurban