WooCommerce prints out all of the information about your products, which is generally pretty useful information for your customers. Sometimes, however, you may want to hide some of that information. With a bit of code, it's pretty easy to hide the product tabs.
To remove product tabs, we perform the following steps:
tabs
in the source code._tab
syntax at the end of the class. You just need the first part.functions.php
file, add the following code:add_filter( 'woocommerce_product_tabs', 'woocommerce_cookbook_remove_product_tabs', 10 ); function woocommerce_cookbook_remove_product_tabs( $tabs ) { return $tabs; }
woocommerce_cookbook_remove_product_tabs
function, we have to specify exactly which tabs we want to remove. Just before the return $tabs;
line, add the following code:unset( $tabs['description'] );
description
with the class of the tab you want to remove. For example, it could read unset( $tabs['description'] );
or unset( $tabs[additional_information] );
or something else based on extra plugins adding more tabs.The woocommerce_product_tabs
filter allows you to add, rearrange, or remove tabs to suit your liking.
It's actually a best practice to put this code in its own plugin rather than in your theme's functions.php
file. For more details, refer to the Creating a WooCommerce plugin recipe in Chapter 1, WooCommerce Basics.