Skip to content

Instantly share code, notes, and snippets.

@rohit-ghoghari
Created December 21, 2020 08:16
Show Gist options
  • Save rohit-ghoghari/e27bedeebd1fbed1a945c99b525fcde1 to your computer and use it in GitHub Desktop.
Save rohit-ghoghari/e27bedeebd1fbed1a945c99b525fcde1 to your computer and use it in GitHub Desktop.
<?php
/**
* 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', 'additional_info_tabs_callback', 98 );
function additional_info_tabs_callback( $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