mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Do not fail when cannot fill form in block continuation
This commit is contained in:
parent
7cfa376456
commit
dc2c60a6f2
1 changed files with 11 additions and 6 deletions
|
@ -39,12 +39,17 @@ const PayPalComponent = ({
|
||||||
if (!config.scriptData.continuation || !config.scriptData.continuation.order || window.ppcpContinuationFilled) {
|
if (!config.scriptData.continuation || !config.scriptData.continuation.order || window.ppcpContinuationFilled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const paypalAddresses = paypalOrderToWcAddresses(config.scriptData.continuation.order);
|
try {
|
||||||
const wcAddresses = wp.data.select('wc/store/cart').getCustomerData();
|
const paypalAddresses = paypalOrderToWcAddresses(config.scriptData.continuation.order);
|
||||||
const addresses = mergeWcAddress(wcAddresses, paypalAddresses);
|
const wcAddresses = wp.data.select('wc/store/cart').getCustomerData();
|
||||||
wp.data.dispatch('wc/store/cart').setBillingAddress(addresses.billingAddress);
|
const addresses = mergeWcAddress(wcAddresses, paypalAddresses);
|
||||||
if (shippingData.needsShipping) {
|
wp.data.dispatch('wc/store/cart').setBillingAddress(addresses.billingAddress);
|
||||||
wp.data.dispatch('wc/store/cart').setShippingAddress(addresses.shippingAddress);
|
if (shippingData.needsShipping) {
|
||||||
|
wp.data.dispatch('wc/store/cart').setShippingAddress(addresses.shippingAddress);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// sometimes the PayPal address is missing, skip in this case.
|
||||||
|
console.log(err);
|
||||||
}
|
}
|
||||||
// this useEffect should run only once, but adding this in case of some kind of full re-rendering
|
// this useEffect should run only once, but adding this in case of some kind of full re-rendering
|
||||||
window.ppcpContinuationFilled = true;
|
window.ppcpContinuationFilled = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue