mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Merge pull request #3551 from woocommerce/PCP-5027-checkout-error
Fix undefined properties error in checkout block (5027)
This commit is contained in:
commit
8a48732966
1 changed files with 2 additions and 2 deletions
|
@ -27,7 +27,7 @@ export const paypalAddressToWc = ( address ) => {
|
|||
admin_area_2: 'city',
|
||||
postal_code: 'postcode',
|
||||
};
|
||||
if ( address.city ) {
|
||||
if ( address?.city ) {
|
||||
// address not from API, such as onShippingChange
|
||||
map = {
|
||||
country_code: 'country',
|
||||
|
@ -38,7 +38,7 @@ export const paypalAddressToWc = ( address ) => {
|
|||
}
|
||||
const result = {};
|
||||
Object.entries( map ).forEach( ( [ paypalKey, wcKey ] ) => {
|
||||
if ( address[ paypalKey ] ) {
|
||||
if ( address?.[ paypalKey ] ) {
|
||||
result[ wcKey ] = address[ paypalKey ];
|
||||
}
|
||||
} );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue