Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Created May 13, 2021 04:52
Show Gist options
  • Select an option

  • Save wbcomdev/b9f20cd5f3bb20dd270f5fac245a3172 to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/b9f20cd5f3bb20dd270f5fac245a3172 to your computer and use it in GitHub Desktop.
/**
* 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.
*/
function wb_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;
}
add_filter( 'woocommerce_product_tabs', 'wb_woo_rename_tabs', 98 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment