mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Do not create wc order in webhook when no form data
This commit is contained in:
parent
8835f4b2a9
commit
e678967c55
1 changed files with 8 additions and 0 deletions
|
@ -159,6 +159,14 @@ class CheckoutOrderApproved implements RequestHandler {
|
|||
WC()->cart->calculate_shipping();
|
||||
|
||||
$form = $this->session_handler->checkout_form();
|
||||
if ( ! $form ) {
|
||||
return $this->failure_response(
|
||||
sprintf(
|
||||
'Failed to create WC order in webhook event %s, checkout data not found.',
|
||||
$request['id'] ?: ''
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$checkout = new WC_Checkout();
|
||||
$wc_order_id = $checkout->create_order( $form );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue