I am trying to calculate the sum total from two custom sub-fields using ACF. The custom field is called 'repeater' and the sub-field is called 'space_avail'. I've tried the code below but it just lists the numbers individually rather than adding them up to a total. Please help.
<?php $total = 0; while(the_repeater_field('repeater' )): the_sub_field('space_avail' ); $total += get_sub_field('space_avail' ); endwhile; echo $total; ?>