Open palomamtnez opened 3 years ago
Hi @palomamtnez,
So I've ran into the same issue as you did and here is what I found.
OrderAdjustment
currency converter in Commerce (it doesn't pass the currency to formatter): craftcms/commerce/src/models/OrderAdjustment.php#L115Transaction
looks like (when it has defined currency): craftcms/commerce/src/models/Transaction.php#L184CurrencyAttributeBehavior
): craftcms/commerce/src/behaviors/CurrencyAttributeBehavior.php#L164This issue will occure when craftcms\commerc\elements\Order->currency
has different value other than what is set to base currency.
I think this is the intended behavior on Commerce side but still feels wrong:
This helped the transaction to remain valid when having same currency and payment currency but not the same as base currency:
use craft\commerce\events\TransactionEvent;
use craft\commerce\services\Transactions;
Event::on(Transactions::class, Transactions::EVENT_AFTER_CREATE_TRANSACTION, function (TransactionEvent $event) {
$tx = &$event->transaction;
if ($tx->currency !== $tx->paymentCurrency) { return; }
$tx->paymentCurrency = $tx->currency;
$tx->paymentAmount = $tx->amount;
$tx->paymentRate = 1;
});
Do you have currency issue on the transaction tab?
Description
The main currency is set up as NZD, however, the grid shows orders that were paid in USD showing without the currency code.
Shipping is displaying in NZD when the order was paid in a different currency.
Examples 1.
2.
To Reproduce How, and what happened? As screenshots
Expected behavior
Additional info
Stripe for Craft Commerce: 2.3.2.1 PayPal for Craft Commerce: 2.1.0.1