Currency Conversion using API Keys

Hi,
I’m trying to build an ecommerce store and am in the process of trying to implement a currency selector. I have the selection system all working with just a simple dropdown input that stores the chosen currency in the user’s data however I am running into issues when trying to actually convert prices to the chosen currency.

I have tried numerous plugins and simply the API Connector (which I struggle to use) and the only one that I find any use is the Alphavantage Currency Converter but I am using API keys from: https://exchangeratesapi.io/ .

This has worked great and I now have every price displaying the original price (in GBP) * The exchange rate from GBP to the chosen currency (currently, USD, EUR, JPY, AUD and CAD) and then formatted correctly. To get the exchange rate I “get external data from API” and use the Alphavantage currency converter plugin and the convert from GBP to “Current User’s Currency” and then take the exchange.

The exchange rates are updating in real time (though on a limit) and work perfectly outputting the correct conversions every time, however the issue that I am now facing is that when I stop working on my site and come back to it later the conversions do not work correctly anymore, they simply shows 0.00. If I inspect with the debugger tool it seems that the plugin is just not working and all the results for when I take the exchange rate are “empty”.

This has happened twice now and I’m not sure how I resolved it the first time. I don’t understand why it all works perfectly and then with no changes stops working. Can anyone figure this out or know any alternative methods to achieve the same desired outcome?

Any help is greatly appreciated,
Many thanks,
Freddie :grin:

Just to add to this, I have come back to my site a few hours later and with nothing changed, everything seems to be working fine again. However I strongly suspect that this will not last. :sweat_smile:
Any help that may fix this long term would still be appreciated!!!

EDIT: Unsurprisingly, 30 mins of work on the site later and the currency conversions have stopped working again. :pensive:

Does anyone have a solution… :pleading_face:

Also struggling with this… I think it is just an API response time issue… which is why sometimes it is fast enough and sometimes not. I have had the same issue with 3 different APIs… the next step of the workflow fires before the API is finished so it ends up blank.

The next step should rely on Result of step 1 so it knows to wait for the API call response. Do you have it setup to capture errors? Then you can handle it accordingly if it errors out or not. Also maybe you’re being rate limited? Most of the free APIs probably have a limit per month or per minute

1 Like