If statement shortcode

Try this:

<?php

function howitworks() {
    $page = get_page_by_title('shop');
    $html="";
    if (have_rows('steps', $page->ID)) :
        $html .= '<div class="test">';
        while (have_rows('steps', $page->ID)) : the_row();
            $image = get_sub_field('icon');
            $html .= '<div class="col">
                    <img src="'.$image['sizes']['thumbnail'].'" alt="'.$image['alt'].'" title="'.$image['alt'].'" />
                    <h2>'.get_sub_field('step').'</h2>
                    <p>'.get_sub_field('description').'</p>
                </div>';
        endwhile;
        $html .= '</div>';
    endif;
    return $html;
}
add_shortcode('howitworks', 'howitworks');
?>

EDIT: I change up my code for replace the_sub_field by get_sub_field