I want to change my quote currency code to EUR when an order is placed in any other currency.
I tried writing event and observer of event
In my observer I have this code
$quoteId = $observer->getEvent()->getOrder()->getQuoteId(); $quote = $this->cartRepository->get($quoteId); $this->storeManager->getStore()->setCurrentCurrencyCode('EUR'); $quote->setQuoteCurrencyCode("EUR"); $quote->collectTotals(); $this->cartRepository->save($quote);
But after order is placed currency did not change to Euro.
I tried another event
sales_quote_save_after, where currency is changed after every save of quote, but in that case, even the customer will see that his cart currency is changed to EUR, which I don't want. I only want to change the currency when order is being placed (the customer should not be shown this anywhere, except on my orders)