Skip to content

Commit

Permalink
check if charges object is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayisha committed Jan 24, 2025
1 parent 40775bd commit 4d1aaf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/class-wc-stripe-webhook-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ private function get_order_from_intent( $intent ) {
}

// Try to retrieve from the charges array.
if ( ! empty( $intent->charges ) ) {
if ( ! empty( $intent->charges ) && is_array( $intent->charges ) ) {
$charge = $intent->charges[0] ?? [];
$order_id = $charge->metadata->order_id ?? null;
return $order_id ? wc_get_order( $order_id ) : false;
Expand Down

0 comments on commit 4d1aaf7

Please sign in to comment.