I'm building a plugin for Wordpress to create new payment gateway in woocommerce. In this plugin, I need to send clients ip address to api.
Well, $_SERVER['REMOTE_ADDR'] is not giving me correct ip address when i use that in plugins php file. WC_Geolocation::get_ip_address() is not working too, both of them giving me the servers ip if I use them in plugin file. If I use them in footer.php, it gives me correct ip address. So, it must be not about server configuration, actually, when i try to display clients ip in receipt page, in receipt section both of them gives me servers ip while they give me correct ip in footer.
What causes to display servers ip address when using $_SERVER['REMOTE_ADDR']?
Are there any alternatives?