diff --git a/modules/ppcp-axo-block/resources/js/helpers/fieldHelpers.js b/modules/ppcp-axo-block/resources/js/helpers/fieldHelpers.js index c04b62a24..d7064e004 100644 --- a/modules/ppcp-axo-block/resources/js/helpers/fieldHelpers.js +++ b/modules/ppcp-axo-block/resources/js/helpers/fieldHelpers.js @@ -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, diff --git a/modules/ppcp-axo-block/resources/js/hooks/useShippingAddressChange.js b/modules/ppcp-axo-block/resources/js/hooks/useShippingAddressChange.js index 2c45b8930..d22904ab0 100644 --- a/modules/ppcp-axo-block/resources/js/hooks/useShippingAddressChange.js +++ b/modules/ppcp-axo-block/resources/js/hooks/useShippingAddressChange.js @@ -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, diff --git a/modules/ppcp-axo/resources/js/Views/ShippingView.js b/modules/ppcp-axo/resources/js/Views/ShippingView.js index 4853659b7..1b3cbd94f 100644 --- a/modules/ppcp-axo/resources/js/Views/ShippingView.js +++ b/modules/ppcp-axo/resources/js/Views/ShippingView.js @@ -44,7 +44,7 @@ class ShippingView { ? this.states[ countryCode ][ stateCode ] : stateCode; - if ( this.hasEmptyValues( data, stateName ) ) { + if ( this.hasEmptyValues( data ) ) { return `
@@ -71,9 +71,9 @@ class ShippingView { ) }
${ data.value( 'street1' ) }
${ data.value( 'street2' ) }
-
${ data.value( - 'city' - ) }, ${ stateName } ${ data.value( 'postCode' ) }
+
${ data.value( 'city' ) }${ + stateName ? ', ' + stateName : '' + } ${ data.value( 'postCode' ) }
${ 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' ) ); }