From 698e851010c65d0767bb4ff5ed0c604ac43b0b74 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Fri, 16 Feb 2024 15:52:37 -0500 Subject: [PATCH] Handle undefined booking_id in express checkout (#8218) --- changelog/fix-bookings-id-undefined-variable | 5 +++++ .../class-wc-payments-express-checkout-button-helper.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/fix-bookings-id-undefined-variable diff --git a/changelog/fix-bookings-id-undefined-variable b/changelog/fix-bookings-id-undefined-variable new file mode 100644 index 00000000000..04066ac1349 --- /dev/null +++ b/changelog/fix-bookings-id-undefined-variable @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Small defensive check for booking_id variable. + + diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php b/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php index 4c42635d102..c5194b5a888 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php @@ -109,7 +109,7 @@ public function ajax_add_to_cart() { $data += $this->build_display_items(); $data['result'] = 'success'; - if ( $booking_id ) { + if ( ! empty( $booking_id ) ) { $data['bookingId'] = $booking_id; }