Reviews 

Liquify are official Shopify Experts & Partners since 2014. If you follow a link to Shopify from our website and make a subsequent purchase this may result in a commission at no extra cost to you. Our opinions remain our own.

For any Shopify clients affected by the recent API geolocation API change from freegeoip.net – we’re just going to cover a quick fix.

The email you may have received from Shopify is something like:

I’m writing you because your shop, blah-blah.com, has custom code to redirect visitors based on their IP address. This code was outlined in an optional unsupported guide on the Shopify Help Center. As of July 3, the public API that this guide relied on was deprecated by the developer (read more here).

The redirects set up through this tutorial no longer function as intended. If you would like to continue redirecting visitors based on their IP address, there are multiple solutions that I’ll outline. The first option is to follow the new steps created by the API developer, which you can read more about here. There are also multiple apps you can find in our App store that provide redirect based on IP address functionality. The third option is to hire a developer or a Shopify Expert to install custom code that adds this functionality.

If you’re confused about what to do after reading the developers documentation read on…you’re not alone. Lots of people used to use this free API and now it’s been depreciated – it’s time to fix it.

The Fix

This should not take long but you need to be comfortable editing theme code files. If you’re not then one of our Shopify developers will be happy to help (we’ve done 10 sites this week already including our own).

1 – go over to ip stack and open an account. You will be fine with a free plan if your traffic is low. Else grab a plan which fits your traffic level (easily calculated based on Google Analytics data)

What you need is your new API key from the dashboard.

Once you have that then you need to locate the following code in your theme:

jQuery.ajax( {
url: '//freegeoip.net/json/',
type: 'POST',
dataType: 'jsonp',
success: function(location) {

Assuming you just implemented Shopify’s tutorial as it was when the API was free – you need to replace the line

url: '//freegeoip.net/json/',

with

url: 'https://api.ipstack.com/check?access_key=paste_your_API_Key_here&output=json&legacy=1',

Obviously – you need to add your key where it says: paste_your_API_Key_here

The API should then query correctly. Check the console after for errors or warnings.

If you’re struggling with this then give us a shout using the form below. Happy to help.

Joe Dempsey

Joe Dempsey

Joe Dempsey is a Shopify Expert. With over 8 years of experience in eCommerce & Shopify he leads one of the most experienced Shopify Expert teams in the world. Founder of Liquify, he tends to work with large brands and Shopify Plus merchants who want to scale aggressively. He is a well known Shopify SEO expert & one of the most experienced Shopify developers in the world.