This code fixes problem for wrong on sale badges

    add_filter( 'woocommerce_product_is_on_sale', function ( $on_sale, $product ) {
        if ( $on_sale && function_exists( 'flatsome_percentage_clear' ) ) {
            flatsome_percentage_clear( $product );
        }

        return $on_sale;
    }, 1000, 2 );