mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
fallback if payer.phone is not defined
This commit is contained in:
parent
e33a13482e
commit
1f297b3add
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,8 @@ export const payerData = () => {
|
|||
if (! payer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const phone = (typeof payer.phone !== 'undefined') ? payer.phone.phone_number.national_number : '';
|
||||
return {
|
||||
email_address:(document.querySelector('#billing_email')) ? document.querySelector('#billing_email').value : payer.email_address,
|
||||
name : {
|
||||
|
@ -20,7 +22,7 @@ export const payerData = () => {
|
|||
phone : {
|
||||
phone_type:"HOME",
|
||||
phone_number:{
|
||||
national_number : (document.querySelector('#billing_phone')) ? document.querySelector('#billing_phone').value : payer.phone.phone_number.national_number
|
||||
national_number : (document.querySelector('#billing_phone')) ? document.querySelector('#billing_phone').value : phone
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue