mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Apple Pay: Fix shipping method switching inside of the Apple Pay modal in Classic Checkout
This commit is contained in:
parent
f96293542a
commit
f52117c196
1 changed files with 18 additions and 8 deletions
|
@ -644,10 +644,12 @@ class ApplepayButton {
|
|||
return {
|
||||
action: 'ppcp_update_shipping_method',
|
||||
shipping_method: event.shippingMethod,
|
||||
simplified_contact:
|
||||
this.updatedContactInfo ||
|
||||
this.initialPaymentRequest.shippingContact ||
|
||||
this.initialPaymentRequest.billingContact,
|
||||
simplified_contact: this.hasValidContactInfo(
|
||||
this.updatedContactInfo
|
||||
)
|
||||
? this.updatedContactInfo
|
||||
: this.initialPaymentRequest?.shippingContact ??
|
||||
this.initialPaymentRequest?.billingContact,
|
||||
product_id,
|
||||
products: JSON.stringify( this.products ),
|
||||
caller_page: 'productDetail',
|
||||
|
@ -662,10 +664,12 @@ class ApplepayButton {
|
|||
return {
|
||||
action: 'ppcp_update_shipping_method',
|
||||
shipping_method: event.shippingMethod,
|
||||
simplified_contact:
|
||||
this.updatedContactInfo ||
|
||||
this.initialPaymentRequest.shippingContact ||
|
||||
this.initialPaymentRequest.billingContact,
|
||||
simplified_contact: this.hasValidContactInfo(
|
||||
this.updatedContactInfo
|
||||
)
|
||||
? this.updatedContactInfo
|
||||
: this.initialPaymentRequest?.shippingContact ??
|
||||
this.initialPaymentRequest?.billingContact,
|
||||
caller_page: 'cart',
|
||||
'woocommerce-process-checkout-nonce': this.nonce,
|
||||
};
|
||||
|
@ -948,6 +952,12 @@ class ApplepayButton {
|
|||
|
||||
return btoa( utf8Str );
|
||||
}
|
||||
|
||||
hasValidContactInfo( value ) {
|
||||
return Array.isArray( value )
|
||||
? value.length > 0
|
||||
: Object.keys( value || {} ).length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
export default ApplepayButton;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue