Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 5a0baa1

Browse files
authored
Fix broken dynamic address fields dependent on locale for selected country. (#2547)
* add missing dependency * Don’t include all defaultAddressFields in address field config
1 parent 26fbdc3 commit 5a0baa1

File tree

2 files changed

+10
-6
lines changed
  • assets/js
    • base/components/cart-checkout/address-form
    • blocks/cart-checkout/checkout

2 files changed

+10
-6
lines changed

assets/js/base/components/cart-checkout/address-form/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const AddressForm = ( {
9494
countryValidationError,
9595
setValidationErrors,
9696
clearValidationError,
97+
type,
9798
] );
9899

99100
id = id || instanceId;

assets/js/blocks/cart-checkout/checkout/block.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ const Checkout = ( { attributes, scrollToTop } ) => {
136136
setShippingAsBilling,
137137
showBillingFields,
138138
} = useCheckoutAddress();
139-
const addressFields = useMemo( () => {
139+
const addressFieldsConfig = useMemo( () => {
140140
return {
141-
...defaultAddressFields,
142141
company: {
143142
...defaultAddressFields.company,
144143
hidden: ! attributes.showCompanyField,
@@ -253,8 +252,10 @@ const Checkout = ( { attributes, scrollToTop } ) => {
253252
id="shipping"
254253
onChange={ setShippingFields }
255254
values={ shippingFields }
256-
fields={ Object.keys( addressFields ) }
257-
fieldConfig={ addressFields }
255+
fields={ Object.keys(
256+
defaultAddressFields
257+
) }
258+
fieldConfig={ addressFieldsConfig }
258259
/>
259260
{ attributes.showPhoneField && (
260261
<ValidatedTextInput
@@ -311,8 +312,10 @@ const Checkout = ( { attributes, scrollToTop } ) => {
311312
onChange={ setBillingFields }
312313
type="billing"
313314
values={ billingFields }
314-
fields={ Object.keys( addressFields ) }
315-
fieldConfig={ addressFields }
315+
fields={ Object.keys(
316+
defaultAddressFields
317+
) }
318+
fieldConfig={ addressFieldsConfig }
316319
/>
317320
</FormStep>
318321
) }

0 commit comments

Comments
 (0)