Handle missing billing address for express block

This commit is contained in:
Alex P 2023-03-21 10:27:02 +02:00
parent 6a882bb628
commit b824de4e33
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -105,7 +105,11 @@ const PayPalComponent = ({
useEffect(() => {
const unsubscribeProcessing = onPaymentProcessing(() => {
const shippingAddress = paypalOrderToWcShippingAddress(paypalOrder);
const billingAddress = paypalPayerToWc(paypalOrder.payer);
let billingAddress = paypalPayerToWc(paypalOrder.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(paypalOrder.payer)};
}
return {
type: responseTypes.SUCCESS,