Error: Call to a member function isZero() on null

Created on 14 July 2025, about 1 month ago

Describe your bug or feature request.

In one of our projects, we get the following error for commerce_payment in the logs:

Error: Call to a member function isZero() on null in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentProcess->isVisible() (line 118 of /usr/www/users/x/x/web/modules/contrib/commerce/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php) #0 /usr/www/users/x/x/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase..php(113): Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentProcess->isVisible()
#1 [internal function]: Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\{closure}()
#2 /usr/www/users/x/x/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php(111): array_filter()
#3 /usr/www/users/xx/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php(132): Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->getVisiblePanes()
#4 /usr/www/users/x/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php(275): Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->isStepVisible()
#5 /usr/www/users/x/web/modules/contrib/commerce/modules/checkout/src/Plugin/Block/CheckoutProgressBlock.php(93): Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->getVisibleSteps()
#6 /usr/www/users/x/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\commerce_checkout\Plugin\Block\CheckoutProgressBlock->build()
#7 [internal function]: Drupal\block\BlockViewBuilder::preRender()
#8 /usr/www/users/x/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#9 /usr/www/users/x/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
[...]

I am unsure why and how this happens, but there is a clear fix for this as inside the following if case:
$this->order->getBalance()->isZero() "this->order->getBalance()" can be null.

If a bug, provide steps to reproduce it from a clean install.

🐛 Bug report
Status

Active

Version

3.0

Component

Payment

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024