diff --git a/modules/ppcp-blocks/resources/js/checkout-block.js b/modules/ppcp-blocks/resources/js/checkout-block.js index ded06b319..015601d52 100644 --- a/modules/ppcp-blocks/resources/js/checkout-block.js +++ b/modules/ppcp-blocks/resources/js/checkout-block.js @@ -31,7 +31,7 @@ const PayPalComponent = ({ const {responseTypes} = emitResponse; const [paypalOrder, setPaypalOrder] = useState(null); - const [gotoContinuation, setGotoContinuation] = useState(false); + const [gotoContinuationOnError, setGotoContinuationOnError] = useState(false); const methodId = fundingSource ? `${config.id}-${fundingSource}` : config.id; @@ -153,7 +153,7 @@ const PayPalComponent = ({ if (config.finalReviewEnabled) { location.href = getCheckoutRedirectUrl(); } else { - setGotoContinuation(true); + setGotoContinuationOnError(true); onSubmit(); } } catch (err) { @@ -172,7 +172,7 @@ const PayPalComponent = ({ if (config.scriptData.continuation) { return true; } - if (gotoContinuation && wp.data.select('wc/store/validation').hasValidationErrors()) { + if (gotoContinuationOnError && wp.data.select('wc/store/validation').hasValidationErrors()) { location.href = getCheckoutRedirectUrl(); return { type: responseTypes.ERROR }; } @@ -180,7 +180,7 @@ const PayPalComponent = ({ return true; }); return unsubscribe; - }, [onCheckoutValidation, gotoContinuation] ); + }, [onCheckoutValidation, gotoContinuationOnError] ); const handleClick = (data, actions) => { if (isEditing) {