How to remove tabs from woocommerce product data section in admin
We know that woocommerce is a widely used plugin to build shopping websites in wordpress. So, when we are adding products we have a section named “Product Data” just below the content editor. In this section we have various tabs like general, inventory, linked products etc.
Sometimes we do not use few of them, so we want to remove them for a good user experience. Here I am providing a small code snippet to remove unwanted tabs from that particular section. To do this we will use a woocommerce predefined filter in the below mentioned way.
Just copy and paste below mentioned code snippet to functions.php file :
function remove_tab($tabs){ unset($tabs['inventory']); // it is to remove inventory tab //unset($tabs['advanced']); // it is to remove advanced tab //unset($tabs['linked_product']); // it is to remove linked_product tab //unset($tabs['attribute']); // it is to remove attribute tab //unset($tabs['variations']); // it is to remove variations tab return($tabs); } add_filter('woocommerce_product_data_tabs', 'remove_tab', 10, 1);
In the above mentioned code we are just removing a tab named “inventory” from the list of all the tabs. You can remove any other tab as per your choice. I have put a line for each tab, just uncomment any of them which you want to remove from that section.
thank you very much, works great…
can you please make a tutorial how to replace woocommerce short description with long description. for example i want to write a long description but to show it in the short description area. ( next to product image. )
Did you solve this?
I also need this. Actually I dont want to use any tab at long description. I want to use wp editors abilitiy.
Thanks in advance
I just solved this problem for myself a few minutes ago! 😀
Add the following to your functions.php file:
add_action( ‘woocommerce_before_single_product’, ‘themeprefix_woocommerce_template_product_description’, 20 );
/**
* Add product description above product
* Output description tab template using ‘woocommerce_before_single_product’ hook
*/
function themeprefix_woocommerce_template_product_description() {
wc_get_template( ‘single-product/tabs/description.php’ );
}
add_filter( ‘woocommerce_product_tabs’, ‘themeprefix_woo_remove_product_tabs’, 98 );
/**
* Remove WooCommerce Description Tab
*/
function themeprefix_woo_remove_product_tabs( $tabs ) {
unset( $tabs[‘description’] ); // Remove the description tab
return $tabs;
}
Works like a charm. Thank you
This works great for the default woocommerce tabs, but I have been unable to use it to remove tabs added by woocommerce extensions like bookings and deposits.
bookings_availability, bookings_pricing, deposits, etc. are all proper tab names, but they don’t unset via this function.
Any suggestions?