WordPress   

How to add, remove or rename product tabs in Woocommerce

In this article we will discuss about customizing the Woocommerce product tabs. We can easily remove exisiting product tabs (Description, Review & Addtional Information) or we can add new product tabs. In this example we will remove Additional Information product tab and add two new product tabs. You can easily customize the following code snippet to change Tab names etc.

Default Tab key for your reference

Description – description

Reviews – reviews

Additional Information – additional_information

//Custom Product tabs
add_filter( 'woocommerce_product_tabs', 'woocommerce_custom_product_tabs' );
function woocommerce_custom_product_tabs( $tabs ) {
	unset( $tabs['additional_information'] ); //Remove Tabs 
    $tabs['reviews']['title'] = __( 'Ratings' );  //Rename Tabs	  
    $tabs['product_tab_1'] = array(
        'title'     => __( 'Tab 1'),
        'priority'  => 120,
        'callback'  => 'woocommerce_custom_product_tab_1_content'
    );
    $tabs['product_tab_2'] = array(
        'title'     => __( 'Tab 2'),
        'priority'  => 130,
        'callback'  => 'woocommerce_custom_product_tab_2_content'
    );
    return $tabs;
}

function woocommerce_custom_product_tab_1_content() {
	global $post;
	$ID = $post->ID;
	$tabContent = 'Custom Product Tab 1'; //or use ACF's custom field like this get_field('custom_field_key', $ID);
	echo $tabContent;
}
function woocommerce_custom_product_tab_2_content() {
	global $post;
	$ID = $post->ID;
	$tabContent = 'Custom Product Tab 2'; //or use ACF's custom field like this get_field('custom_field_key', $ID);
	echo $tabContent;
}
Need Professional Support for Your Website Problems?

Whether you're facing website issues or struggling with code implementation, our team is here to assist. Hire us to get your website back on track.

Hire Us