Jump to content

How to set currency in Commerce programmatically?


Go to solution Solved by newbie LAC,

Recommended Posts

Posted

When a user goes to the store they can change the currency using this widget:

currencies.png.73f001d8b3fa8494af0d0a1280044105.png

How can I change it programmatically?

I figured it's not a database setting as if I set the currency in one browser, it goes back to the default in a different browser. I also don't see any cookies about currency setting.

Is it using $_SESSIONs?

I just want to be able to manually change from the default currency if the user is from the U.K. for example.

  • Solution
Posted

See template chooseCurrency

{{$memberCurrency = ( ( isset( $_SESSION['currency'] ) and in_array( $_SESSION['currency'], \IPS\nexus\Money::currencies() ) ) ? $_SESSION['currency'] : \IPS\nexus\Customer::loggedIn()->defaultCurrency() );}}

 

  • 2 years later...
Posted
On 5/31/2018 at 11:24 PM, Tom S. said:

I just want to be able to manually change from the default currency if the user is from the U.K. for example.

@Tom S. I need this too, can you submit the code?
Thanks for your help.

  • Recently Browsing   0 members

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