Geolocation is a method for identifying where a person is located based on their IP address. Using geolocation in PrestaShop you can restrict access to your store, based on a visitor's location. You can restrict certain countries from purchasing items from your store, or even prevent visitors from certain countries from even viewing your store.
- Begin by logging into your PrestaShop back office.
- Click on the Preferences tab and then the Geolocation link under that tab.
- Just under the Geolocation heading you will see a notice to download a file and extract it to your /tools/geoip directory. To download the file (named GeoLiteCity.dat) click the "this file" link. Take note of where on your local computer the file is saved.
- Using the cPanel File Manager, upload the file to your PrestaShop tools/geoip directory. The full upload path will vary according to where you installed PrestaShop, but the last part of the path will be tools/geoip. Using our example, we installed PrestaShop into the shop subdomain so the directory to upload the file to is public_html/shop/tools/geoip.
- Once your file is uploaded, right click the file and choose Extract.
- When the extraction is finished, go back into your PrestaShop back office, select Enabled under the Geolocation by IP address heading and click Save.
- Under Options, choose whether restricted countries can view your catalog without being able to order or not view the catalog at all.
- Also under Options, choose whether other countries can place orders (All features are available), view your site catalog but not place orders, or be blocked from viewing the site altogether as well. You will likely want to choose All features are available unless you need to restrict your site from all visitors.
- The last section under Options is where you choose the countries that can access your PrestaShop site. If you only have a few countries you will be selling to, you can quickly deselect all the countries by clicking the box next to Name at the top of the list twice. Then select which countries should be allowed to fully access your website and place orders from your PrestaShop store.
- Click the Save button under options to save any changes you made in the Options area.
- The last section of the Geolocation preferences is the IP address whitelist. If you have an IP address that you always want to allow access to your PrestaShop site (e.g. Google bot or another search engine IP address) you can add that IP to the list and click the Save button to update the whitelist.
Anytime you want to change your Geolocation settings in PrestaShop, you can simply navigate back into this area of your PrestaShop back office and make any updates you wish to either the Options or the IP address whitelist.