How to prevent those PHP variables from being cached on WordPress?

Page caching generates a static HTML version of the page so IP geolocation occurs on the first rendering and is not triggered on subsequent renderings – your use case is not compatible with W3 Total Cache’s page caching.

It’s possible to accomplish what you are trying to accomplish with page caching, however, you would need to write your own caching implementation to check against a visitor geolocation cookie or $_GET parameter to serve different static HTML documents dependent upon the contents of its value (well beyond the scope of any simple coding).