0

I need to change the quote currency to order from the mobile app. For this, I send the quote id from the mobile app, I did the following code on Magento, but it did not work. Suggest me the correct way to change the currency code

$quote = $this->quoteFactory->create()->load(627);
$quote->setQuoteCurrencyCode('USD');
$quote->save()
0

You can try like this:

$quote->setBaseCurrencyCode('USD');
$quote->setGlobalCurrencyCode('USD');
$quote->setQuoteCurrencyCode('USD');
$quote->setStoreCurrencyCode('USD');
$quote->save();

Note: Code is not tested but hopes it will work as expected.

0

Please try this:

 /** @var \Magento\Quote\Model\Cart\Currency $quoteCurrency */
                $quoteCurrency = $this->quoteCurrencyFactory->create()
                    ->setGlobalCurrencyCode(""GBP"")
                    ->setBaseCurrencyCode(""GBP"")
                    ->setStoreCurrencyCode(""GBP"")
                    ->setQuoteCurrencyCode(""GBP"")
                    ->setStoreToBaseRate(1.00)
                    ->setStoreToQuoteRate(1.00)
                    ->setBaseToGlobalRate(1.00)
                    ->setBaseToQuoteRate(1.00);
    
    /** @var \Magento\Quote\Model\Quote $quote */
                $quote = $this->cartRepositoryInterface->get($cartId);
                $quote->setStore($store);
    
                // forcefully changing the currency for quote
                $quote->setForcedCurrency($directoryCurrency);
                $quote->setBaseCurrencyCode(""GBP"");
                $quote->setGlobalCurrencyCode(""GBP"");
                $quote->setStoreCurrencyCode(""GBP"");
                $quote->setQuoteCurrencyCode(""GBP"");
                $quote->setCurrency($quoteCurrency);
                $quote->save();
-1

You should use quote Model

$quote = Mage::getModel('sales/quote')->load($shoppingcartid);

Then Set Currency

$quote->setCurrency('GBP');
1
  • The tag of this question is magento2, you are providing code for magento 1
    – Jimmy
    Mar 26 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.