PHP Snippet 1:
add_filter( 'woocommerce_product_tabs', 'am_ninja_remove_product_tabs', 98 );
function am_ninja_remove_product_tabs( $tabs ) {
global $product;
$id = $product->get_id(); // change this to $product->id fro WC less than 2.7
$my_custom_data = get_post_meta($id, 'am_ninja', true );
if(empty($my_custom_data)) {
unset( $tabs['additional_information'] ); // Remove the additional information tab
}
return $tabs;
}
PHP Snippet 2:
//Removing product data tabs
add_action('init', 'tws_remove_product_tabs');
function tws_remove_product_tabs() {
remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10);
}
PHP Snippet 3:
//Adding product additional info in summary - if it's empty hide it
add_action('woocommerce_single_product_summary', 'woocommerce_product_additional_information_tab', 25);
function woocommerce_product_additional_information_tab() {
global $product;
if ($product - > has_attributes() || $product - > has_dimensions() || $product - > has_weight()) { // Check if product has attributes, dimensions or weight
return $tabs;
wc_get_template('single-product/tabs/additional-information.php');
}
}
PHP Snippet 4:
[1]: https://docs.woocommerce.com