Add phone number from Payer to block checkout

This commit is contained in:
Daniel Hüsken 2025-02-26 14:56:21 +01:00
parent 758419c980
commit 8bac91c875
No known key found for this signature in database
GPG key ID: 9F732DA37FA709E8

View file

@ -81,12 +81,14 @@ export const paypalShippingToWc = ( shipping ) => {
export const paypalPayerToWc = ( payer ) => {
const firstName = payer?.name?.given_name ?? '';
const lastName = payer?.name?.surname ?? '';
const phone = payer?.phone?.phone_number?.national_number ?? '';
const address = payer.address ? paypalAddressToWc( payer.address ) : {};
return {
...address,
first_name: firstName,
last_name: lastName,
email: payer.email_address,
phone: phone
};
};