Support

Account

Home Forums Add-ons Repeater Field Get minimum value from ACF Repeater Reply To: Get minimum value from ACF Repeater

  • 
    if (have_rows('fares_from')) {
      $term = false;
      $fare_price = false;
      while (have_rows('fares_from')) {
        the_row();
        if ($fare_price === false || get_sub_field('fare_price') < $fare_price) {
          $fare_price = get_sub_field('fare_price');
          $term = get_sub_field('fares_from_taxonomy');
        }
      } // end while have rows
      if ($term)  {
        ?>
          <span><?php echo $term->name; ?></span>
          <span><?php echo $fare_price; ?></span>
        <?php 
      }
    } // end if have rows