mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Set billing addr from shipping addr when no payer addr
This commit is contained in:
parent
c43af44a2f
commit
eaf7985145
1 changed files with 11 additions and 1 deletions
|
@ -139,7 +139,17 @@ export const paypalOrderToWcAddresses = (order) => {
|
|||
billingAddress = paypalPayerToWc(order.payer);
|
||||
// no billing address, such as if billing address retrieval is not allowed in the merchant account
|
||||
if (!billingAddress.address_line_1) {
|
||||
billingAddress = {...shippingAddress, ...paypalPayerToWc(order.payer)};
|
||||
// use only non empty values from payer address, otherwise it will override shipping address
|
||||
let payerAddress = Object.fromEntries(
|
||||
Object.entries(billingAddress).filter(
|
||||
([key, value]) => value !== '' && key !== 'country'
|
||||
)
|
||||
);
|
||||
|
||||
billingAddress = {
|
||||
...shippingAddress,
|
||||
...payerAddress
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue