Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Currency error in orders #18

Open
palomamtnez opened this issue Feb 11, 2021 · 1 comment
Open

Currency error in orders #18

palomamtnez opened this issue Feb 11, 2021 · 1 comment

Comments

@palomamtnez
Copy link

Description

  1. The main currency is set up as NZD, however, the grid shows orders that were paid in USD showing without the currency code.

  2. Shipping is displaying in NZD when the order was paid in a different currency.

Examples
1.
Screen Shot 2021-02-10 at 10 25 39 AM

Screen Shot 2021-02-10 at 10 25 19 AM

Screen Shot 2021-02-10 at 10 24 50 AM

To Reproduce
How, and what happened?
As screenshots

Expected behavior

  1. Show all orders in the grid with their respective currency codes.
  2. Show shipping with their respective currency code.

Additional info

  • Craft version: 3.5.16
  • Commerce version: 3.2.14
  • Commerce Currency Prices: 2.7.1
  • PHP version: 7.3.26
  • Database driver & version: MySQL 5.7.33
  • Other Plugins & versions:

Stripe for Craft Commerce: 2.3.2.1
PayPal for Craft Commerce: 2.1.0.1

@onetdev
Copy link

onetdev commented Feb 22, 2021

Hi @palomamtnez,

So I've ran into the same issue as you did and here is what I found.

This 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:
image

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants