Merge pull request #3535 from woocommerce/PCP-5012-address-mapping-for-non-us-non-ca-countries-fails-in-fastlane-ryan-flow

Axo: Make the state address data optional to fix non US-CA compatibility (5012)
This commit is contained in:
Niklas Gutberlet 2025-08-04 19:26:23 +02:00 committed by GitHub
commit ff38eb06ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 9 deletions

View file

@ -121,7 +121,7 @@ export const populateWooFields = (
address_1: address.addressLine1, address_1: address.addressLine1,
address_2: address.addressLine2 || '', address_2: address.addressLine2 || '',
city: address.adminArea2, city: address.adminArea2,
state: address.adminArea1, state: address.adminArea1 || '',
postcode: address.postalCode, postcode: address.postalCode,
country: address.countryCode, country: address.countryCode,
phone: phoneNumber.nationalNumber, phone: phoneNumber.nationalNumber,

View file

@ -32,7 +32,7 @@ export const useShippingAddressChange = ( fastlaneSdk, setShippingAddress ) => {
address_1: address.addressLine1, address_1: address.addressLine1,
address_2: address.addressLine2 || '', address_2: address.addressLine2 || '',
city: address.adminArea2, city: address.adminArea2,
state: address.adminArea1, state: address.adminArea1 || '',
postcode: address.postalCode, postcode: address.postalCode,
country: address.countryCode, country: address.countryCode,
phone: phoneNumber.nationalNumber, phone: phoneNumber.nationalNumber,

View file

@ -44,7 +44,7 @@ class ShippingView {
? this.states[ countryCode ][ stateCode ] ? this.states[ countryCode ][ stateCode ]
: stateCode; : stateCode;
if ( this.hasEmptyValues( data, stateName ) ) { if ( this.hasEmptyValues( data ) ) {
return ` return `
<div style="margin-bottom: 20px;"> <div style="margin-bottom: 20px;">
<div class="axo-checkout-header-section"> <div class="axo-checkout-header-section">
@ -71,9 +71,9 @@ class ShippingView {
) }</div> ) }</div>
<div>${ data.value( 'street1' ) }</div> <div>${ data.value( 'street1' ) }</div>
<div>${ data.value( 'street2' ) }</div> <div>${ data.value( 'street2' ) }</div>
<div>${ data.value( <div>${ data.value( 'city' ) }${
'city' stateName ? ', ' + stateName : ''
) }, ${ stateName } ${ data.value( 'postCode' ) }</div> } ${ data.value( 'postCode' ) }</div>
<div>${ valueOfSelect( <div>${ valueOfSelect(
'#billing_country', '#billing_country',
countryCode countryCode
@ -158,14 +158,13 @@ class ShippingView {
} ); } );
} }
hasEmptyValues( data, stateName ) { hasEmptyValues( data ) {
return ( return (
! data.value( 'email' ) || ! data.value( 'email' ) ||
! data.value( 'firstName' ) || ! data.value( 'firstName' ) ||
! data.value( 'lastName' ) || ! data.value( 'lastName' ) ||
! data.value( 'street1' ) || ! data.value( 'street1' ) ||
! data.value( 'city' ) || ! data.value( 'city' )
! stateName
); );
} }