Full width home advertisement

IT Sharing

Travel the world

Climb the mountains

Post Page Advertisement [Top]

Rename product tabs

Here are the default product tabs we are going to remove in this tutorial:

WooCommerce product tabs

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.

Main content area of WooCommerce products
If you make it empty, the “Description” tab will disappear.

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”:

Enable reviews for WooCommerce products individually in Product Data metabox
Uncheck this checkbox and the Reviews tab will disappear for this particular product.

Or you can also do it globally for all products in WooCommerce settings:

Enable or disable WooCommerce product reviews globally
Please keep in mind that it doesn’t override the individual product 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?

  1. First of all let’s find out the tab ID, to do it, print_r() the $tabs array inside the woocommerce_product_tabs filter hook, I recommend setting priority 98 to the hook in this case,
  2. unset() that tab
Source: rudrastyh

Không có nhận xét nào:

Đăng nhận xét

Bottom Ad [Post Page]