- 🇩🇪Germany Anybody Porta Westfalica
Just ran into a similar issue in latest 2.40! This shouldn't happen.
We're going to have a closer look after the holidays!DivisionByZeroError: Division by zero in bcdiv() (Zeile 96 in /web/modules/contrib/commerce/modules/price/src/Calculator.php).
#0 /web/modules/contrib/commerce/modules/price/src/Calculator.php(96): bcdiv() #1 /web/modules/contrib/commerce/modules/price/src/Price.php(169): Drupal\commerce_price\Calculator::divide() #2 /web/modules/contrib/commerce/modules/order/src/Entity/OrderItem.php(256): Drupal\commerce_price\Price->divide() #3 /web/modules/contrib/google_tag/src/Plugin/GoogleTag/Event/Commerce/AddToCartEvent.php(38): Drupal\commerce_order\Entity\OrderItem->getAdjustedUnitPrice() #4 /web/modules/contrib/google_tag/google_tag.module(147): Drupal\google_tag\Plugin\GoogleTag\Event\Commerce\AddToCartEvent->getData() #5 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(311): google_tag_page_attachments() #6 /web/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #7 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(308): Drupal\Core\Extension\ModuleHandler->invokeAllWith() #8 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(285): Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks() #9 /web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #10 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(284): Drupal\Core\Render\Renderer->executeInRenderContext() #11 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare() #12 /web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() #13 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() #14 /web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func() #15 /vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #16 /vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #17 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle() #18 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #19 /web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #20 /web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle() #21 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle() #22 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass() #23 /web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle() #24 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle() #25 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #26 /web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #27 /web/modules/contrib/remove_http_headers/src/StackMiddleware/RemoveHttpHeadersMiddleware.php(49): Drupal\Core\StackMiddleware\AjaxPageState->handle() #28 /web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle() #29 /web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() #30 /web/index.php(19): Drupal\Core\DrupalKernel->handle() #31 {main}
- 🇩🇪Germany Grevil
The issue from @Anybody and I would be solved in 🐛 Error: Call to a member function getEntityTypeId() on null Active . We wrongly allowed to set a quantity of "0", which resulted in the error.
- 🇮🇱Israel jsacksick
@grevil: But the issue linked is a Commerce API issue, not a Commerce one.
- 🇩🇪Germany Grevil
@jsacksick Indeed! But we ended up in commerce, since we unintentionally allowed a quantity of "0". The original entry point was "commerce_api".