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

Don't clear email and phone fields when using separate billing address. #4162

Merged
merged 3 commits into from
May 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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