I have been all over the forums for this idea. I am trying to convert currencies with the help of some plugins, but none seem to work. Does anyone have any ideas to help me achieve this? If you are using a plugin and it is working, what are you doing?
I haven’t tried any plugins for this, but there are plenty of free APIs you can use for up-to-date exchange rates.
We use Foreign exchange rates API with currency conversion to do currency exchange for our ecommerce site, but there are plenty of others depending on what level of features you need.
Then just do any conversions in Bubble, either in the browser in real time or (maybe a better idea) run a regular backend workflow to keep converted prices in your DB up-to-date with the latest exchange rates.
Thank you, I dont know how to work with JS or any other type of code well enough to get anywhere. I think that is why I am having this issue.
You don’t need any code for what I’ve outlined above, it can all be done very simply, no-code, with standard Bubble functionality
Just a single API call to get the exchange rates (which you can either access in real time or save in your database), then just use basic mathematical expressions to convert whatever prices you have into whichever currency you need (again either in real time in the browser, or on the backend to store in the database).
There are a few different ways you can go about setting and working with multiple currencies. I guess which method you use will depend on what you’re trying to achieve and how your app database is set up.
Where does that API call come from if not a plugin? Are you wanting to use the API Connector? Is this done as a step to workflow?
It would all be real-time as this isn’t data stored in the database. It’s just a text field. It’s a text field that updates based on a dropdown selection for currency.
Sorry, but I have no direction with what you have outlined.
Yes, the API call is done in the API connector.
So in your case you’d set the API call type as ‘Data’ so you can access it in expressions in the editor.
If the prices you’re converting are all in the same base currency it’s easy (just us that currency as the base currency in your API call), then just multiply that by the exchange rate of the currency you want to convert it into.
If the initial price can be in various currencies then you’ll first need to convert it into you base currency (by dividing it by the base currency’s exchange rate), then multiply it by the exchange rate of the currency you wan to convert it to.
To select the desired currency you’ll need to use conditionals, so based on the dropdown selection you’ll use a different conversion rate from the API data.
You’ll need a conditional for each currency you have in the dropdown, so if you have a lot of currencies then using conditionals might get a bit complex, but if you’re only using 5-10 or so, it’s easy enough to set up.
If you’re going to use a lot of currencies it may be easer to create a currency datatype in the DB, set it from the API data, and then use that to do the conversion - as you can then use dynamic data from the drop down to select the currency directly, rather then having dozens of conditionals to find the right one.
Hey, I was able to get all of that to work. I appreciate it a ton. I had to limit my choices because I wanted to throw something up quickly, but thats okay.
This topic was automatically closed after 70 days. New replies are no longer allowed.