The callback used to render the “Description” tab is woocommerce_product_description_tab()
, which simply loads the template file single-product/tabs/description.php
. And for the “Additional Information” tab, the callback is woocommerce_product_additional_information_tab()
and the template is single-product/tabs/additional-information.php
.
So if you want to merge the two tabs, you can copy the “relevant” contents from the template file, like so:
add_filter( 'woocommerce_product_tabs', 'exetera_custom_product_tabs', 98 );
function exetera_custom_product_tabs( $tabs ) {
// Custom description callback.
$tabs['description']['callback'] = function() {
global $post, $product;
// Display the content of the Description tab.
the_content();
// Display the heading and content of the Additional Information tab.
echo '<h2>Additional Information</h2>';
do_action( 'woocommerce_product_additional_information', $product );
};
// Remove the additional information tab.
unset( $tabs['additional_information'] );
return $tabs;
}
Alternate Version
Here we simply call the default callbacks and for the “Description” tab, we disable the default heading text.
add_filter( 'woocommerce_product_tabs', 'exetera_custom_product_tabs', 98 );
function exetera_custom_product_tabs( $tabs ) {
// Custom description callback.
$tabs['description']['callback'] = function() {
// Disable the "Description" heading.
add_filter( 'woocommerce_product_description_heading', '__return_empty_string' );
// Display the content of the Description tab.
woocommerce_product_description_tab();
// Enable the "Description" heading.
remove_filter( 'woocommerce_product_description_heading', '__return_empty_string' );
// Display the heading and content of the Additional Information tab.
woocommerce_product_additional_information_tab();
};
// Remove the additional information tab.
unset( $tabs['additional_information'] );
return $tabs;
}