Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Orders don't necessarily have a payment method when checkout is completed, e.g. an order with zero total may be programmatically completed through checkout with commerce_checkout_complete().
commerce_stripe_pi_commerce_checkout_complete() doesn't check for a payment method array key in $order->data before attempting to access it, resulting in
Notice: Undefined index: payment_method in commerce_stripe_pi_commerce_checkout_complete() (line 922 of /var/www/html/sites/all/modules/contrib/commerce_stripe_pi/commerce_stripe_pi.module).
Simple fix:
- if ($order->data['payment_method'] !== 'commerce_stripe_pi|commerce_payment_commerce_stripe_pi') {
+ if (!isset($order->data['payment_method']) || $order->data['payment_method'] !== 'commerce_stripe_pi|commerce_payment_commerce_stripe_pi') {
return;
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 3159814.patch | 655 bytes | David Sparks |
Comments
Comment #2
David Sparks CreditAttribution: David Sparks as a volunteer commentedPatch attached
Comment #4
GoZ CreditAttribution: GoZ at Iosan, Barbe-Rousse commentedThanks for your contribution. Nice catch.