Integrate Relevanssi into Flatsome

By default, Flatsome only displays shop result for its search page. To integrate Relevanssi into Flatsome, we need to add the below code to child theme function.php:

remove_action( 'woocommerce_after_main_content', 'flatsome_pages_in_search_results', 10 );
// Add Pages and blog posts to top of search results if set.
function relevanssi_pages_in_search_results() {
if ( ! is_search() || ! get_theme_mod( 'search_result', 1 ) ) {
return;
}
global $post;
if ( get_search_query() ) {
$args = array(
'post_type' => 'post',
's' => get_search_query(),
);
$query = new WP_Query();
		$query->parse_query( $args );
		relevanssi_do_query( $query );
		$posts = array();
		while ( $query->have_posts() ) {
			$query->the_post();
			array_push( $posts, $post->ID );
		}
		$args = array(
			'post_type' => 'page',
			's'         => get_search_query(),
		);
		$query = new WP_Query();
		$query->parse_query( $args );
		relevanssi_do_query( $query );
		$pages = array();
		while ( $query->have_posts() ) {
			$query->the_post();
			$wc_page = false;
			if ( 'page' === $post->post_type ) {
				foreach ( array( 'shop', 'cart', 'checkout', 'view_order', 'terms' ) as $wc_page_type ) {
					if ( $post->ID === wc_get_page_id( $wc_page_type ) ) {
						$wc_page = true;
					}
				}
			}
			if ( ! $wc_page ) {
				array_push( $pages, $post->ID );
			}
		}
		do_action( 'flatsome_products_page_loader' );
                if ( ! empty( $posts ) || ! empty( $pages ) ) {
                     $list_type = get_theme_mod( 'search_result_style', 'slider' );
                     if ( ! empty( $posts ) ) {    
		            
                             
add_action( 'woocommerce_after_main_content', 'relevanssi_pages_in_search_results', 10 );

Full code: ref: https://www.relevanssi.com/knowledge-base/flatsome-theme-product-search-results-page/