How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]

you need to return your code when using shortcodes. Additionally you didn’t close the function.

try this:

function menu_loop() {

    $menu = '<div class="entry-content dishes">';

    // check if the repeater field has rows of data
    if (have_rows('menu_sections')):

        // loop through the rows of data
        while (have_rows('menu_sections')) : the_row();

            // display a sub field value

            $menu .= '<h2>' . get_sub_field('section_title') . '</h2>';
            if (have_rows('sections_items')) :

                $menu .= '<table><thead><tr><td class="ja_name">Name</td><td class="ja_description">Description</td><td class="ja_price">Price</td></tr></thead>';

                while (have_rows('section_items')): the_row();
                    $menu .= '<tr><td>' . the_sub_field('dish_names') . '</td><td>' . the_sub_field('dish_description') . '</td><td>$ ' . the_sub_field('dish_price') . '</td></tr>';
                endwhile;

                $menu .= '</table> ';

            else :
                // no rows found
            endif;

        endwhile;

    else :
        //echo 'no rows found';
    endif;

    $menu .= '</div>';
    // Code
    return $menu;
}

add_shortcode('testimonials', 'menu_loop');

I just checked your code one more time…
you are echoing the_sub_field on your while statement. That might mess things up. Try changing the_sub_field to get_sub_field in your while statement (x3 issues) if the above code places your fields out of place.