Hey,
You r welcome but I should have been able to do that without having you send me the file. lol. I ran into something very similar a while back on something I was working on but forgot about it until I was looking at the file.
For the record in case anyone searches on this at some point:
The problem was that the wrong function was being used.
the_field() echoes the value in the field to the page.
get_field() pulls in the value.
So the change was changing the_field() to get_field() and it all worked as expected.
https://www.advancedcustomfields.com...ces/the_field/
.