Problem/Motivation

When loged in as admin. The following error occurs on website pages:
Commerce order is mentiond.
I also use Commerce Currency Resolve.
The error in the log:
Type commerce_order
Drupal\Core\Entity\EntityStorageException: The provided prices have mismatched currencies: 16 EUR, 0 USD. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of /home/xxxxxxxx.nl/public_html/commerce/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

The page error shows:

Drupal\Core\Entity\EntityStorageException: The provided prices have mismatched currencies: 16 EUR, 0 USD. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\commerce_price\Price->add(Object) (Line: 426)
Drupal\commerce_order\Entity\Order->recalculateTotalPrice() (Line: 332)
Drupal\commerce_order\Entity\Order->addAdjustment(Object) (Line: 60)
Drupal\commerce_shipping\LateOrderProcessor->process(Object) (Line: 156)
Drupal\commerce_order\OrderRefresh->refresh(Object) (Line: 127)
Drupal\commerce_order\OrderStorage->doOrderPreSave(Object) (Line: 108)
Drupal\commerce_order\OrderStorage->invokeHook('presave', Object) (Line: 500)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 700)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 454)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 837)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 395)
Drupal\Core\Entity\EntityBase->save() (Line: 140)
Drupal\commerce_currency_resolver\CurrencyOrderProcessor->process(Object) (Line: 156)
Drupal\commerce_order\OrderRefresh->refresh(Object) (Line: 102)
Drupal\commerce_currency_resolver\EventSubscriber\CurrencyOrderRefresh->checkCurrency(Object, 'commerce_order.commerce_order.load', Object)
call_user_func(Array, Object, 'commerce_order.commerce_order.load', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('commerce_order.commerce_order.load', Object) (Line: 92)
Drupal\commerce\CommerceContentEntityStorage->postLoad(Array) (Line: 165)
Drupal\commerce_order\OrderStorage->postLoad(Array) (Line: 1097)
Drupal\Core\Entity\ContentEntityStorageBase->loadUnchanged('68') (Line: 95)
Drupal\commerce_order\OrderStorage->loadUnchanged('68') (Line: 495)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 700)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 454)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 837)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 395)
Drupal\Core\Entity\EntityBase->save() (Line: 160)
Drupal\commerce_order\OrderStorage->postLoad(Array) (Line: 307)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 225)
Drupal\commerce_cart\CartProvider->loadCartData(Object) (Line: 177)
Drupal\commerce_cart\CartProvider->getCartIds(Object) (Line: 55)
Drupal\commerce_cart\Cache\Context\CartCacheContext->getContext(NULL) (Line: 118)
Drupal\Core\Cache\Context\CacheContextsManager->convertTokensToKeys(Array) (Line: 307)
Drupal\Core\Render\RenderCache->createCacheID(Array) (Line: 66)
Drupal\Core\Render\RenderCache->get(Array) (Line: 109)
Drupal\Core\Render\PlaceholderingRenderCache->get(Array) (Line: 77)
Drupal\Core\Render\RenderCache->get(Array) (Line: 109)
Drupal\Core\Render\PlaceholderingRenderCache->get(Array) (Line: 137)
Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object) (Line: 127)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

in all pages, but not in admin/edit pages

Comments

pindaman created an issue. See original summary.

tok2a3’s picture

I'm having the same problem. Did you solve it?

jsacksick’s picture

Project: Commerce Core » Commerce Currency Resolver
Version: 8.x-2.15 » 8.x-1.x-dev
Component: DrupalCommerce.org » Code

If this happens when used in combination with the Commerce Currency Resolver module, then this isn't a Commerce core issue.

kristofferrom’s picture

I had this issue today too and I don't use the Commerce Currency Resolver module. I had 2 currencies enabled, the shipping rates was entered in one currency, product prices in another. Aligning those to the same currency made the error go away.

londova’s picture

Such an error may appear when on site with shippable products is used "Commerce Currency Resolver" module but it is not installed the "Commerce Currency Resolver Shipping" module.

matthieu_collet’s picture

We have the same issue
"Commerce Currency Resolver" and "Commerce Shipping" are enabled

valic’s picture

@matthieu_collet and tok2a3, are you using commerce_shipping? If yes, do you have enabled submodule for shipping?

Currency resolver ships submodule which handles shipping conversion (commerce_currency_resolver_shipping)

matthieu_collet’s picture

Hi Valic
yes just after writing my comments I activated it and effectively, it works !

valic’s picture

Marking this as outdated. There are a couple of other issues that can be related to this if all submodules of the resolver are enabled. If the shipping submodule is not enabled, but shipping is used then I suggest enabling it. (or create shipping methods with conditions per each enabled currency)

valic’s picture

Status: Fixed » Closed (outdated)