Display HTML only if Custom Field has a Value

You can use the “get_sub_field” to test for the subfields. If nothing is returned and they are empty, it won’t show the content associated with the if statement.

<?php
if ( get_field('ingredients-list') )
{
    echo '<ul class="ingredientsList">';
    while ( has_sub_field('ingredients-list') )
    {
        echo '<li class="ingredient" itemprop="ingredients">';
            echo '<label for="">' . get_sub_field('quantity') . '&nbsp; ';
                if ( get_sub_field('measurement') ) echo '<span class="amount">' . get_sub_field('measurement') . '</span> ';
                if ( get_sub_field('ingredient_name') ) echo '<span class="name">&nbsp;'. get_sub_field('ingredient_name') .'</span>';
                if ( get_sub_field('measurement') ) echo '<span class="notes">&nbsp;' . get_sub_field('notes')  . ' </span>';
            echo '</label>';
        echo '</li>';
    }
    echo '</ul>';
}
?>