Rename product tabs |
Here are the default product tabs we are going to remove in this tutorial:
Remove Description Tab
The “Description” tab displays the main content area of the product. So, the tab won’t be displayed if the main content is empty.
But if you need a code solution, here it is:
add_filter( 'woocommerce_product_tabs', 't2ds_remove_description_tab', 11 ); function t2ds_remove_description_tab( $tabs ) {
unset( $tabs['description'] ); return $tabs; }
You should also know something about the hook priority! You must use a value 10 or higher. If you decide to use the value below 10, then nothing will work.
Remove Additional Information Tab
First things first – how to remove this tab without coding? This tab is needed to display product attributes. So… no attributes – no “Additional information” tab
Code approach:
add_filter( 'woocommerce_product_tabs', 't2ds_remove_additional_information' ); function t2ds_remove_additional_information( $tabs ) {
unset( $tabs['additional_information'] ); return $tabs; }
Remove Reviews Tab
If you want to hide the “Reviews” tab, consider just disabling the product reviews first. You can enable or disable product reviews individually for each product in “Product data” meta box”:
Or you can also do it globally for all products in WooCommerce settings:
If settings is not what you need, here is a code solution as well
add_filter( 'woocommerce_product_tabs', 't2ds_remove_reviews_tab' ); function t2ds_remove_reviews_tab( $tabs ) {
unset( $tabs['reviews'] ); return $tabs; }
Remove a Custom Product Tab
Maybe you installed a plugin which added a custom tab and you do not want this tab to be displayed on your store product pages. But this the plugin doesn’t have any settings where you can just deactivate the tab.
What to do?
- First of all let’s find out the tab ID, to do it,
print_r()
the$tabs
array inside thewoocommerce_product_tabs
filter hook, I recommend setting priority 98 to the hook in this case, unset()
that tab
Không có nhận xét nào:
Đăng nhận xét