Jump to content

How to change base currency?


Beekingo

Recommended Posts

Hello!

We are using WHMCS with Argentine Peso as base currency. We want to add US Dollar and update pesos automatically based on dollar price.

Now if i add dollars to my install, when update prices it will change the prices in dollars, not pesos because they are the base currency.

I like to update pesos prices based on dollar prices. There are any trick to do this? Or do i need to change the base currency to dollars and add peso as secondary.

If i do this, what i will need to take care?

Regards,

Link to comment
Share on other sites

We have a guide on changing the default currency here: https://help.whmcs.com/m/payments/l/1122770-changing-the-default-currency

HOWEVER, this is strong discouraged because it will break all existing transactions, invoices, credit balances etc because customers currently set to Peso will be changed to USD but the amounts won't be converted.

You may be able to overcome this by changing the default currency, then using a database query to switch all customers over to the secondary peso currency ID in the database, this isn't however supported so you should test this in a development install first and throughly check that everything is set correctly and working before making any changes to your live install and ensure you have a backup in case you need to restore. I would also recommend ensuring maintenance mode is enabled prior to making changes to avoid any transactions during the process.

Link to comment
Share on other sites

On 19/09/2020 at 00:28, Beekingo said:

We are using WHMCS with Argentine Peso as base currency. We want to add US Dollar and update pesos automatically based on dollar price.

in addition to what Dan said (and i'd discourage you from changing default currencies if you have existing transactions too) - how do you intend to update the peso rate based on USD ? the WHMCS currency update wouldn't support ARS, so you couldn't do it automatically in WHMCS unless you employ a third-party solution.

Link to comment
Share on other sites

Hello!

I plan to manually change the values 'currency' and 'rate' in table 'tblaccounts'. And the value 'currency' in table 'tblaccounts'. So, everyone have the "new" peso currency switched. I do not know if nee to look up for another value to edit. Didn't fine anyone on invoices tables.

@brian! i know that, i will plan to manually update the exchange rave every month.

Thanks

Link to comment
Share on other sites

14 hours ago, Beekingo said:

I plan to manually change the values 'currency' and 'rate' in table 'tblaccounts'.

note that tblaccounts is only for transactions, e.g paid invoices... in WHMCS, currencies are assigned to clients not invoices, so a client's currency will be the currency value in tblclients - and that value will reference the ID field in tblcurrencies.

14 hours ago, Beekingo said:

i know that, i will plan to manually update the exchange rate every month.

if this is purely about updating Argentine prices based on USD rates, i'm wondering if you could do this instead once a month - i'm assuming you have products priced in both USD and ARS.

  1. put WHMCS into maintenance mode so that nobody can order while you're updating prices.
  2. backup the database.
  3. change your default currency in tblcurrencies from ARS to USD - that should be setting the 'default' column value in tblcurrencies for USD to '1' and ARS to '0'.
  4. enter the two exchange rates - USD will be 1.0000, ARS will be whatever it is on that day, e.g 75.3000
  5. from the currencies page in WHMCS, run the pricing update - that will update the pricing based on the exchange rate... it will add pricing to products in all active currencies regardless of whether you have a cycle enabled or not (i've always considered that to be a bug).
  6. change your default currency in tblcurrencies back to ARS from USD - that should be setting the 'default' column value in tblcurrencies for USD to '0' and ARS to '1'.
  7. remove WHMCS from maintenance mode.

you may want to check with Support or perhaps @WHMCS Dan could comment as to whether this is viable - if it is, then it removes the need for you to edit multiple database tables and reassign values in them... all you have to do is the above process once a month.

another option might be to use bendrop's hook that allows for automated exchange rates in non-supported currencies...

... though it wouldn't help with basing your pricing on a non-default currency, only with keeping your USD pricing linked to ARS, but you want it the other way around.

Link to comment
Share on other sites

4 hours ago, brian! said:

note that tblaccounts is only for transactions, e.g paid invoices... in WHMCS, currencies are assigned to clients not invoices, so a client's currency will be the currency value in tblclients - and that value will reference the ID field in tblcurrencies.

if this is purely about updating Argentine prices based on USD rates, i'm wondering if you could do this instead once a month - i'm assuming you have products priced in both USD and ARS.

  1. put WHMCS into maintenance mode so that nobody can order while you're updating prices.
  2. backup the database.
  3. change your default currency in tblcurrencies from ARS to USD - that should be setting the 'default' column value in tblcurrencies for USD to '1' and ARS to '0'.
  4. enter the two exchange rates - USD will be 1.0000, ARS will be whatever it is on that day, e.g 75.3000
  5. from the currencies page in WHMCS, run the pricing update - that will update the pricing based on the exchange rate... it will add pricing to products in all active currencies regardless of whether you have a cycle enabled or not (i've always considered that to be a bug).
  6. change your default currency in tblcurrencies back to ARS from USD - that should be setting the 'default' column value in tblcurrencies for USD to '0' and ARS to '1'.
  7. remove WHMCS from maintenance mode.

you may want to check with Support or perhaps @WHMCS Dan could comment as to whether this is viable - if it is, then it removes the need for you to edit multiple database tables and reassign values in them... all you have to do is the above process once a month.

another option might be to use bendrop's hook that allows for automated exchange rates in non-supported currencies...

... though it wouldn't help with basing your pricing on a non-default currency, only with keeping your USD pricing linked to ARS, but you want it the other way around.

Hello! I really like your approach. Will try it one night this week.

Thanks!

Link to comment
Share on other sites

On 21/09/2020 at 19:19, Beekingo said:

Silly question, what happens if i keep the default flag changed forever?

it's not necessarily a silly question - if USD was kept as the default, then it would show currency amounts (unconverted) in the admin area in USD rather than ARS.. I wouldn't leave USD as the default other than when you're running the pricing update.

Link to comment
Share on other sites

  • 1 year later...

Hello!

I am in the same case trying to do the same thing, do you think this procedure can work?

  1. Change name of default currency from ARS to AR
  2. Add new currency as ARS (in my case tblcurrencies id =5)
  3. Change all tblclients rows when currency=1 to currency=5
  4. Change default currency symbol from AR to USD

Observing the table tblaccounts I saw that the value for currency is always kept at 0, so I guess that this value should not be changed, but I see that the table stores the value of rate, do you know if this value has any real use for any calculation of the system or is it just a record?

Best Regards

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated