Add Geolocation to your Liquid Theme

Here’s something to help you customize your Spiffy Store’s Liquid Theme for your overseas customers.

We have added some new Liquid Theme variables that will give you access to the geolocation data for your customer. This will give you access to the Country, Country Code, City and Timezone information for the customer, based on the IP address being used.


Four new methods have been added to the request variable.

[ruby title=”Sample Geolocation methods”]
{{ request.country_code}}
{{ request.country }}
{{ request.city }}
{{ request.timezone }}
[/ruby]

You can use these methods to help you display information in your theme that is customized for your customer’s location. For example, you could provide additional shipping information or information about tax free prices. The timezone information could could be used to let your customers know what your business hours are by taking into account the time differences.

You may wish to restrict certain products or pages to local customers if you’re running a promotion, so you can use the country information to display different information to overseas customers. For example, you may be offering free shipping to local customers only.

Further information can be found at

https://www.spiffystores.com.au/kb/Liquid_Template_Variables_-_request