I am looking for an extension that switches currency based on IP. I have my store setup to allow USD and CAD and I can manually switch between them using the drop-down currency selector in the top right but I want to automate that so that menu is set to the one that matches the IP.
I am mostly new to Magento having previously used a different platform so if I use terms incorrectly that is why.
I started off attempting to Meetanshi Magento 2 Currency Switcher and spent hours on it and have come to the conclusion that it does not work.
I started evaluating some of the not-free extensions that do this and got confused as many mention views and I don't believe I need multiple views-- maybe I do-- but my preference would just be something that checks the IP and changes the currency menu which I believe is different than choosing between two different views.
My final objective is to have a store that displays USD/CAD depending on location of IP, allows customer to switch if incorrectly identified, and then also charges them in the display currency. Since I am using Stripe their payment extension does charge in display currency so I only need something that changes the currency menu between the two currencies automatically.
My stack is Apache 2.4, PHP 8.4, MardiaDB 11.4, OpenSearch 2.19, Redis, and Varnish and this is Magento 2.4.8 with the out of the box theme (Luna).
I have confirmed that the correct IP is being passed though by setting up a PHP file in the pub dirtory that displays $_SERVER['REMOTE_ADDR'];
1) Is there a extension that does what I want or do I need to learn about views and do it that way?
2) Does anyone have a positive outcome with the Meetanshi extension and possibly some insight into why it won't work for me?
Hi @carlosnald8841 ,
I haven't tried any paid extensions or below suggestion as well. But you can try using a third-party API to find a user’s country from their IP address.
For example, you can use:
Create an observer that listens for the controller_action_predispatch event. In that observer, call your chosen API to get the country based on the visitor’s IP, then set the store’s currency code according to the API response.
Thanks
Ankit
Hi @carlosnald8841 ,
If you don't want to try custom code and API based response below extension also seems working fine. You can check with VPN and validate demo.
Link demo: https://acs.demo.magefan.top/gear/bags.html
Extension: https://magefan.com/magento-2-currency-switcher-auto-currency-by-country
Also, do accept the solution if earlier or current answer worked for you so that anyone else also facing something similar can directly go to the right response.
Thanks
Ankit
I'm using Magefan's currency switcher. It works well.