Merge pull request #641 from woocommerce/PCP-580-manual-orders-return-an-error-for-guest-users

Store order info in wc order meta to get if there is no session.
This commit is contained in:
Emili Castells 2022-05-17 13:55:35 +02:00 committed by GitHub
commit b7c4f23b62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 7 deletions

View file

@ -243,6 +243,13 @@ class CreateOrderEndpoint implements EndpointInterface {
}
$order = $this->create_paypal_order( $wc_order );
if ( 'pay-now' === $data['context'] && is_a( $wc_order, \WC_Order::class ) ) {
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $order->id() );
$wc_order->update_meta_data( PayPalGateway::INTENT_META_KEY, $order->intent() );
$wc_order->save_meta_data();
}
wp_send_json_success( $order->to_array() );
return true;