Try changing all of your acf function calls to include the post ID, but not this is not necessary for get_sub_field()
// change this
if( have_rows('bag_contents', $post_id) ):
while ( have_rows('bag_contents', $post_id) ) :
// don't change this
$produce = get_sub_field('produce');
// change this
update_field('total_servings_per_week', $per_week, $post_id);
And I think you should only need to add your action once at priority 20