Sending shortcode through API

I am using this code to find the IP address of the user. I then want to send this to a service using API to find the country they’re visiting from.
Based on this information, I want to display different sections using Conditional Logic.

My first step is to get a valid response to my API.
If i hard-code the IP address into the API endpoint, I get a valid result
image

However, if I substitute the IP address with the shortcode [display_IP], I get an invalid result even though the request URL seems to be the same as before.
image

I tried this with different API providers, with the same result.

Is there a better way to accomplish what I’m trying to achieve? Is there a reason the IP address using the shortcode is returning an error, even though the IP address returned is the same?

Hi @thomasgeorge,

Unfortunately, the questions related to the custom code are beyond the scope of Theme Support. I would suggest you avail of our newly launched service called One, where we answer questions beyond normal theme support.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.