-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Labels
Description
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 );
}