I want to get shopify store visitor location through geolocation. I tried through this http://www.geoplugin.net/javascript.gp script but when I add this script into the shopify then site goes down. So I need proper solution for the shopify.
I want to get shopify store visitor location through geolocation. I tried through this http://www.geoplugin.net/javascript.gp script but when I add this script into the shopify then site goes down. So I need proper solution for the shopify.
3
Answers
You can make use of any IP to location service provider. consider below example.
Add this script using Script Tag if you are creating an app. otherwise you can add this script on Shopify theme manually.
Another way in the App proxy request shopify gives IP address/ As well as country data in request header.
please follow below screenshot.
in php specif code you can use below code
After installing the shopify geolocation app and activating it for international market, use the endpoint "browsing_context_suggestions.json" to get the country name as:
Shopify Does provide the localization feature. Which detects the local area and map and country. Use the following liquid code to get the list of countries and visitors local country name and code: