Alright, letโs turn PrestaShop Geolocation from โmystery toggleโ into something actually useful ๐๐
Iโll walk you through enable โ configure โ real-world use cases.
โ What is Geolocation in PrestaShop?
Geolocation detects a visitorโs country (and sometimes region) using their IP address.
You can use it to:
- Restrict access by country
- Redirect users
- Show different prices/taxes
- Enable/disable shipping or payments
- Comply with legal rules
๐น Step 1: Enable Geolocation
Back Office Path
International โ Localization โ Geolocation
Settings
- Geolocation by IP address โ โ Yes
- Geolocation behavior for restricted countries
Choose one:- โ Visitors cannot see your catalog
- โ ๏ธ Visitors can see catalog but cannot order
- Whitelist IP addresses
๐ Add your own IP (important for testing)https://whatismyipaddress.com - Click Save
๐น Step 2: Download & Activate GeoLite Database
PrestaShop uses MaxMind GeoLite2.
Do this:
- Click Download the geolocation database
(button is on the same page)
OR manually upload:
/app/Resources/geoip/
or
/tools/geoip/
Required file:
GeoLite2-Country.mmdb
๐ก Without this file, geolocation will NOT work.
๐น Step 3: Enable Country Restrictions
Go to:
International โ Locations โ Countries
For each country:
- โ Enabled โ Visitors can browse/order
- โ Disabled โ Restricted by geolocation
Example:
- Enable: India, UAE
- Disable: Other countries
๐น Step 4: Enable Required Modules
Check these modules are enabled:
- ps_geolocation
- ps_facetedsearch (optional, for filters)
- ps_currencyselector
- ps_languageselector
Path:
Modules โ Module Manager
๐น Step 5: Real-World Uses (Most Important Part)
๐งญ 1. Restrict Orders by Country
- Disable countries you donโt ship to
- Choose โCatalog onlyโ mode for restricted countries
๐ Common for B2B stores
๐ฐ 2. Automatic Tax Calculation
Enable:
International โ Taxes
- Enable tax rules by country
- Tax is applied based on detected country
โ๏ธ Works well for VAT / GST logic
๐ 3. Currency & Language Auto-Selection
PrestaShop can:
- Auto-switch currency
- Auto-switch language
Path:
International โ Localization
- Set default language & currency per country
๐ 4. Shipping Rules by Country
Path:
Shipping โ Carriers
- Assign carriers to specific countries
- Hide shipping methods automatically
๐ 5. Redirect Users (Advanced)
Example:
- India โ
/in/ - UAE โ
/ae/
Needs:
- Override or custom module
.htaccessor hookactionFrontControllerInit
(Ask me if you want ready code for this ๐)
๐น Step 6: Testing Geolocation
Best ways:
- Use VPN (India / US / EU)
- Use proxy IP
- Temporarily disable your country
โ ๏ธ Remember:
- Add your IP to Whitelist
- Clear cache after changes
โ ๏ธ Important Notes
- Geolocation โ 100% accurate
- Doesnโt work well on:
- Mobile networks
- VPN users
- Always allow manual country/language selection
โ Quick Checklist
โ Geolocation enabled
โ GeoLite database installed
โ Countries configured
โ Cache cleared
โ Modules enabled
ย
