In WooCommerce I ma using "WPB WooCommerce Related Products Slider" and "Custom Related Products for WooCommerce" third party plugins.
With the code below I am adding a custom tab to display related products:
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;
}
}
As some of my products don't have related products, how can I make this tab displayed just when there is related products?