Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Checkout reloads when submitting order with empty fields (2389) #1904

Conversation

pedrosilva-pt
Copy link
Contributor

PR Description

To prevent the checkout page from reloading the gotoContinuation status variable was added. It's dynamically set only on scenarios where we want to redirect.

Issue Description

When submitting a payment on the Block Checkout page while some fields are empty, the field error messages will only briefly appear as the page reloads

Steps To Reproduce

  • add product to cart
  • navigate to Block Checkout
  • leave some required fields empty
  • click “Proceed to PayPal” button
  • observe required field error briefly shows
  • then page reloads

Expected behaviour

page does not reload when WC validation failed

@@ -152,6 +153,7 @@ const PayPalComponent = ({
if (config.finalReviewEnabled) {
location.href = getCheckoutRedirectUrl();
} else {
setGotoContinuation(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better name could be something like gotoContinuationOnError or submittingWithoutReview.
Right now it looks a bit confusing because normally submitting in the no-review mode should not result in continuation.

@pedrosilva-pt pedrosilva-pt changed the title Fix block checkout page reloading on form errors. Block Checkout reloads when submitting order with empty fields (2389) Dec 14, 2023
@InpsydeNiklas InpsydeNiklas added this to the 2.4.3 milestone Dec 14, 2023
@InpsydeNiklas InpsydeNiklas merged commit ebc2dc4 into trunk Dec 15, 2023
14 checks passed
@InpsydeNiklas InpsydeNiklas deleted the PCP-2389-block-checkout-reloads-when-submitting-order-with-empty-fields branch December 15, 2023 08:57
@Dinamiko Dinamiko mentioned this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants