How to remove woocommerce tab?

前端 未结 6 1066
[愿得一人]
[愿得一人] 2021-01-11 18:51

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 p

6条回答
  •  一整个雨季
    2021-01-11 19:34

    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 );
    

提交回复
热议问题