Commit 8004f0dfa0f for woocommerce
commit 8004f0dfa0ff2698e5744b9ffa5212c8bfabfb6d
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date: Fri Nov 27 07:27:14 2026 -0500
Fix undefined array key warning in PayPal gateway script attributes (#71331)
diff --git a/plugins/woocommerce/changelog/fix-paypal-undefined-array-key-warning b/plugins/woocommerce/changelog/fix-paypal-undefined-array-key-warning
new file mode 100644
index 00000000000..f9d56547345
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-paypal-undefined-array-key-warning
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix a PHP warning from the PayPal Standard gateway when another's plugin script's attributes don't include an id.
diff --git a/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php b/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
index eaa0629ad55..7a25f374097 100644
--- a/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
+++ b/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
@@ -853,7 +853,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
* @return array
*/
public function add_paypal_sdk_attributes( $attrs ) {
- if ( 'paypal-standard-sdk-js' === $attrs['id'] ) {
+ if ( isset( $attrs['id'] ) && 'paypal-standard-sdk-js' === $attrs['id'] ) {
$buttons = new PayPalButtons( $this );
$page_type = $buttons->get_page_type();