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

Commit

Permalink
Don't clear email and phone fields when using separate billing addres…
Browse files Browse the repository at this point in the history
…s. (#4162)

* preseve-billing-data

* pluck empty email and phone

* add issue number
  • Loading branch information
senadir authored and grogou committed Aug 20, 2021
1 parent 2140147 commit 69b3679
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions assets/js/base/context/hooks/use-checkout-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,16 @@ export const useCheckoutAddress = () => {
previousBillingData.current = billingData;
setBillingData( shippingAddress );
} else {
const {
// We need to pluck out email and phone from previous billing data because they can be empty, causing the current email and phone to get emptied. See issue #4155
/* eslint-disable no-unused-vars */
email,
phone,
/* eslint-enable no-unused-vars */
...billingAddress
} = previousBillingData.current;
setBillingData( {
...previousBillingData.current,
email: undefined,
phone: undefined,
...billingAddress,
} );
}
currentShippingAsBilling.current = shippingAsBilling;
Expand Down

0 comments on commit 69b3679

Please sign in to comment.