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_2: address.addressLine2 || '',
city: address.adminArea2,
state: address.adminArea1,
state: address.adminArea1 || '',
postcode: address.postalCode,
country: address.countryCode,
phone: phoneNumber.nationalNumber,

View file

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

View file

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