Wakanda's avatar
Level 10

eCommerce currency switcher

Hi Devs.

I want to add a multi-currency feature to an existing Laravel project. Currently, the platform supports a single currency. By default, the platform currency is going to be USD and then have other currencies, and if the user selects another currency I would want the view to re-render and display the correct currency.

Frankly, I have no idea how to do this but from the back of my mind, I think I should have a currency table and have rates something like that.

Any ideas?

Thanks.

0 likes
6 replies
Snapey's avatar
Snapey
Best Answer
Level 122

The first question to ask is if these need to be real-time accurate conversions?

If its just a price list represented in different currencies then you should set those prices and ignore exchange rate fluctuations. No one wants to pay 17.36 for something, or tell their boss its going to be $95 then come back the following week to buy and its now $102

So, what type of solution do you need?

If dynamic then you need to hook into an exchange rate api, and probably cache the results every day or every few hours (depending on the purpose)

1 like
Wakanda's avatar
Level 10

@snapey Thanks for your response. It doesn't have to be real-time so I would say there is no need for a 3rd party API

Its something that an admin can manually enter

Snapey's avatar

So where is the difficulty? what can't you get your head around?

Wakanda's avatar
Level 10

@snapey database design for such a scenario. Thanks for your reply I found a related tutorial on devto

Please or to participate in this conversation.