mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Store order info in wc order meta to get if there is no session.
This commit is contained in:
parent
f78dfac648
commit
ab0e90dab0
4 changed files with 26 additions and 7 deletions
|
@ -207,12 +207,6 @@ class CreditCardRenderer {
|
|||
const firstName = document.getElementById('billing_first_name') ? document.getElementById('billing_first_name').value : '';
|
||||
const lastName = document.getElementById('billing_last_name') ? document.getElementById('billing_last_name').value : '';
|
||||
|
||||
if (!firstName || !lastName) {
|
||||
this.spinner.unblock();
|
||||
this.errorHandler.message(this.defaultConfig.hosted_fields.labels.cardholder_name_required);
|
||||
return;
|
||||
}
|
||||
|
||||
hostedFieldsData.cardholderName = firstName + ' ' + lastName;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,6 +242,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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue