Hi,
the right method to do this is to override class method similar_products() or to create your own shortcode. For example add on your theme’s functions.php this code
if( function_exists('YITH_WRVP_Frontend')) {
add_shortcode( 'custom_yith_similar_products', 'custom_yith_similar_products_function' );
function custom_yith_similar_products_function(){
extract( shortcode_atts(array(
'posts_per_page' => get_option( 'yith-wrvp-num-products', '4' ),
'orderby' => 'rand',
'title' => get_option( 'yith-wrvp-section-title' )
), $atts ) );
$similar = YITH_WRVP_Frontend()->get_similar_product();
if( empty( $similar ) ) {
return '';
}
$args = apply_filters( 'yith_wrvp_similar_products_template_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'post__in' => $similar
) );
$products = new WP_Query( $args );
ob_start();
if ( $products->have_posts() ) : ?>
<div class="woocommerce yith-similar-products">
<h2><?php echo $title ?></h2>
<?php woocommerce_product_loop_start(); ?>
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php endwhile; // end of the loop. ?>
<?php woocommerce_product_loop_end(); ?>
</div>
<?php endif;
$content = ob_get_clean();
wp_reset_postdata();
return $content;
}
remove_action( 'woocommerce_after_single_product_summary', array( YITH_WRVP_Frontend(), 'print_shortcode' ), 30 );
add_action( 'woocommerce_after_single_product_summary', 'print_custom_shortcode', 30 );
function print_custom_shortcode(){
echo do_shortcode('[custom_yith_similar_products]');
}
}
So you need only to change title tag as you wish.
Let me know. Greetings.