1

In Magento 2, how do we show prices in other currencies than the base currency rounded up?

For example, when foreign currencies are calculated using today's exchange rate, the price may be shown as $14.40. I want that to show as $15. How do I do that?

Thanks! :_)

2

vendor/magento/framework/pricing/amount/AmountFactory.php

public function create($amount, array $adjustmentAmounts = [])
{
    $amountModel = $this->objectManager->create(
        self::DEFAULT_PRICE_AMOUNT_CLASS,
        [
            'amount' => **round($amount)**,
            'adjustmentAmounts' => $adjustmentAmounts
        ]
    );

    if (!$amountModel instanceof \Magento\Framework\Pricing\Amount\AmountInterface) {
        throw new \InvalidArgumentException(
            get_class($amountModel) . ' doesn\'t implement \Magento\Framework\Pricing\Amount\AmountInterface'
        );
    }

    return $amountModel;
}

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.