I saw this link: Unset product tabs for specific product categories in woocommerce
I want to hide related product tabs for specific products.
I use this code:
remove_action( 'woocommerce_after_single_product_summary', 'wpb_wrps_related_products',22 );
add_filter( 'woocommerce_product_tabs', 'wpb_wrps_adding_related_products_slider_to_product_tab' );
if( !function_exists('wpb_wrps_adding_related_products_slider_to_product_tab') ){
function wpb_wrps_adding_related_products_slider_to_product_tab( $tabs ) {
$tabs['wpb_wrps_related_products_slider'] = array(
'title' => __( 'Related Products','wpb-wrps' ),
'priority' => 30,
'callback' => 'wpb_wrps_related_products'
);
return $tabs;
}
}
I used "unset( $tabs['related_products'] ); // (Related Products tab)" but there are the tab of related products for specific products.
In the code below, you will have to define an array of products where you want to hide the tab:
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested on Woocommerce 3+ and works