So a little poking around and you can call the following endpoint on your store.
/browsing_context_suggestions.json
This gives you a simple object below
{
"detected_values": {
"country_name": "United Kingdom"
},
"suggestions": []
}
Which you can parse and use a if/else of switch statement to show or modify elements on your site via JS.
The query string options for the endpoint that are generated by the app include the below:-
source=locale_bar_app
currency[enabled]=true
currency[exclude]=USD
language[enabled]=true
language[exclude]=en
With the response changing to:-
{
"detected_values": {
"country_name": "United Kingdom"
},
"suggestions": [
{
"parts": {
"currency": {
"handle": "GBP",
"name": "British pounds",
"confidence": 1,
"options": {
"CAD": "CAD $",
"DKK": "DKK kr",
"EUR": "EUR €",
"GBP": "GBP £",
"SEK": "SEK kr",
"USD": "USD $"
}
}
},
"confidence": 1
}
]
}
Would be great if there’s some documentation out there for these options. As using this native functionality would be nicer than needing to rely on third party IP to Country solutions.