Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active March 2, 2022 10:31
Show Gist options
  • Save woogists/4c33d31bbb4134ba1fd692b496d2e0a6 to your computer and use it in GitHub Desktop.
Save woogists/4c33d31bbb4134ba1fd692b496d2e0a6 to your computer and use it in GitHub Desktop.
[Frontend Snippets][Editing product data tabs] Add additional information
/**
* Check if product has attributes, dimensions or weight to override the call_user_func() expects parameter 1 to be a valid callback error when changing the additional tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
global $product;
if( $product->has_attributes() || $product->has_dimensions() || $product->has_weight() ) { // Check if product has attributes, dimensions or weight
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab
}
return $tabs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment