Error getAddress() on null
-
Hi Payment Plugins team,
we’re seeing an intermittent fatal error during Apple Pay / express checkout updates:<code class=””>Critical Uncaught Error: Call to a member function getAddress() on null
insrc/AjaxFrontendHandler.php(around line 84), inside <code class=””>AjaxFrontendHandler::get_update_data().From debugging, the issue is that code in the shipping branch assumes <code class=””>PurchaseUnit::getShipping() is always present and calls <code class=””>->getAddress() / <code class=””>->getSelectedOption() directly. In some valid PayPal order states (early/update calls),
purchase_unit.shippingis not set yet, so this becomes null and crashes.Could you add a null guard before using shipping (e.g. <code class=””>$shipping = $purchase_unit->getShipping(); if ( $shipping ) { … }) so missing shipping blocks are handled safely?
Environment/context:
- WooCommerce + CheckoutWC
- Payment method:
ppcp_applepay - Hook path includes
woocommerce_checkout_update_order_review - Plugin version: 2.0.14
Thanks!
You must be logged in to reply to this topic.