A shopper on the checkout page taps the Apple Pay or Google Pay button, picks a different address in the wallet sheet, and the payment sheet reports an error. The shopper gives up or starts over. In the Magento logs you find a 500 with this message:
Warning: Undefined array key "shippingRates" in
vendor/hyva-themes/magento2-hyva-checkout-stripe/src/Magewire/View/PaymentRequestButton.php on line 244
We saw this on the evening a Magento 2.4.8 store went live on Hyvä Checkout, with hyva-themes/magento2-hyva-checkout-stripe 2.0.13 and the Stripe module 4.6.1. One shopper hit it twice in three minutes and did not place an order.
It does not happen to everyone, which is why it can pass QA. It happens to shoppers whose cart already has a complete shipping address before they open the wallet sheet.
If this problem is costing you orders or staff time, our senior Magento and Hyvä team can help you debug it and deploy a fix safely.
Contact us →
Why it happens
The Express Checkout button in Hyvä Checkout is a Magewire component, PaymentRequestButton. It keeps a resolvePayload that it receives from the Stripe module’s Express Checkout parameters: the line items and, normally, the shipping rates the wallet sheet should offer.
When the quote already has a complete shipping address at page load, the Stripe module does not ask the wallet for shipping details, and its response leaves shippingRates out. The component’s resolvePayload then holds line items only.
If the shopper changes the address inside the wallet sheet anyway, the component’s estimateCart() method runs. It gets fresh rates from Stripe for the new address, and then copies $this->resolvePayload['shippingRates'] over them without checking that the key exists. updateShippingRate() does the same. PHP raises a warning for the missing key, Magento turns warnings into exceptions, and the request ends in a 500.
The shoppers most likely to see it are returning customers with a saved address, and anyone who typed an address into the form first and then decided to pay with a wallet.
1. Confirm it in your logs and your code
Search the logs for the message:
grep -rn 'Undefined array key "shippingRates"' var/log/ | tail
Then check whether your version of the module still reads the key unconditionally:
grep -n "resolvePayload\['shippingRates'\]" \
vendor/hyva-themes/magento2-hyva-checkout-stripe/src/Magewire/View/PaymentRequestButton.php
Two hits on lines that assign $result['resolvePayload']['shippingRates'] with no isset() around them mean your copy has the problem. If the lines are already guarded, your version has been fixed and you do not need the patch.
2. Patch the two unguarded reads
The change is the same in both methods. Keep the vendor behavior when the component has rates, and otherwise leave the rates Stripe just estimated for the new address in place.
--- a/src/Magewire/View/PaymentRequestButton.php
+++ b/src/Magewire/View/PaymentRequestButton.php
@@ estimateCart() and updateShippingRate() @@
$this->reorderShippingRatesBySelectedQuoteMethod();
- $result['resolvePayload']['shippingRates'] = $this->resolvePayload['shippingRates'];
- $this->setResolvePayload($result['resolvePayload']);
+ if (isset($this->resolvePayload['shippingRates']) && is_array($this->resolvePayload['shippingRates'])) {
+ $result['resolvePayload']['shippingRates'] = $this->resolvePayload['shippingRates'];
+ }
+ $this->setResolvePayload(is_array($result['resolvePayload'] ?? null) ? $result['resolvePayload'] : []);
The block above shows the change, not a ready-made patch file. Generate the real patch with diff -u against the exact version you have installed, so the line numbers and context match.
Ship it as a composer patch. Never edit vendor by hand, because the next composer install silently removes the change.
"extra": {
"patches": {
"hyva-themes/magento2-hyva-checkout-stripe": {
"Express Checkout address change no longer fails when shippingRates is absent": "patches/hyva-checkout-stripe-shipping-rates.patch"
}
}
}
With "composer-exit-on-patch-failure": true in the same extra section, an upgrade that makes the patch stale fails the install loudly instead of dropping the fix.
If this problem is costing you orders or staff time, our senior Magento and Hyvä team can help you debug it and deploy a fix safely.
Contact us →
3. Verify
composer install
grep -n "isset(\$this->resolvePayload\['shippingRates'\])" \
vendor/hyva-themes/magento2-hyva-checkout-stripe/src/Magewire/View/PaymentRequestButton.php
bin/magento cache:flush
The grep should return both guarded lines. Then test the path that failed, in a browser with a real wallet set up (Stripe test mode is enough):
- Go to the checkout and fill in a complete shipping address first.
- Open the Google Pay or Apple Pay sheet from the Express Checkout button.
- Choose a different shipping address inside the sheet.
The sheet should update its shipping options and total, and the log should stay quiet.
Notes before you ship this
- Wallet flows are hard to cover with automated tests, because they need a real browser wallet. Put “complete address first, then change it in the wallet sheet” on your manual checkout test list.
- Magento converts PHP warnings into exceptions. In any Magewire component, an array read that assumes a key is present becomes a failed request for the shoppers whose data takes the less common path. After a launch, read the logs for the word “Undefined” on the first evening.
- The patch was cut against version 2.0.13. As of December 2026 the newest release, 2.1.0, still has both unguarded reads in
estimateCart()andupdateShippingRate(), so upgrading alone does not remove the problem. Re-check with the grep in step 1 after every upgrade of the module, and drop the patch once the vendor code guards the read itself.