cancel
Showing results for 
Search instead for 
Did you mean: 

change quote currency programmatically

change quote currency programmatically

I am trying to change the currency of a quote before creating an order programmatically.

This seems to change the currency, but doesn't recalculate the amount:

 

$quote->setQuoteCurrencyCode('EUR');
print_r($quote->getData()); // shows that the currency has changed, not the amount

If I collect totals and save, the currency goes back to what is was before I apply the change:

        $quote->setQuoteCurrencyCode('EUR');
        $quote->collectTotals()->save(); // this resets my changes => doesn't work

 

How can we change the currency of a quote an recalculate the amount when creating an order programmatically?