Create custom function for hero image

get_the_title() returns the post (product) title including all HTML, whitespaces and symbols not allowed in URLs, etc. Use post slug instead.

Also, you don’t need to use any actions.

function custom_hero_image( $post_id ) {

    $product = get_post( $post_id ); 
    $slug    = $product->post_name;

    if ( is_product( $post_id ) ) {
        $html="<img class="jarallax-img" src="". get_template_directory_uri() .'/inc/assets/img/shop/hero/'.$slug.'.jpg">';
    } else {
        $html="<p>No results found.</p>";
    }
    return $html;
}

And call the function within a template file:

<div id="hero">
    <?php
        // get the post ID outside the Loop
        $post_id = get_queried_object_id();
        // print the <img>
        echo custom_hero_image( $post_id );
    ?>
</div>