Your code seems good.
As you said, if you’re calculating your “total_return” into first snippet only, your calculation is working.
Why don’t you update all your field in a single snippet (your first one) ?
If you really need to use different snippets for each field, maybe you could add different priorities to your actions.
See documentation: https://www.advancedcustomfields.com/resources/acf-save_post/
So keep your first snippet without modifications (default priority is 10).
And try adding a priority of 15 for your second snippet :
add_action('save/post' 'my_acf_update_total_return', 15);
Let me know if it helps,
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.