Skip to content

FR: saved currency preference #1104

@cole007

Description

@cole007

Description

For sites offering multiple currencies it would be good to specify a preferred currency to be applied to any future transactions/carts on a per user/account basis.

Did look to see if could tap into User::EVENT_AFTER_LOGIN event so could update any carts based on a stored value (eg in a custom field associated with the user) but cannot seem to modify the currency of the cart object via a plugin (eg via $order->setPaymentCurrency( $curr ); where $curr is the ISO value for the currency.

For example:

Event::on(
  User::class, 
  User::EVENT_AFTER_LOGIN, 
  function (Event $e) {
    $order = Commerce::getInstance()->getCarts()->getCart(true);
    $order->setPaymentCurrency( $curr );
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions