-
Notifications
You must be signed in to change notification settings - Fork 219
Add error message for fetch errors on checkout #5341
Conversation
Size Change: -21.8 kB (-3%) Total Size: 819 kB
ℹ️ View Unchanged
|
let errorNotice = sprintf( | ||
// Translators: %s Error text. | ||
__( | ||
'Error: %s Please try placing your order again.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about Order could not be placed. %s Please try placing your order again.
instead of Error: %s Please try placing your order again.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ralucaStan Updated to 'Something went wrong. %s Please try placing your order again.'
to match other notices.
dispatchActions.setAfterProcessing( response ); | ||
setIsProcessingOrder( false ); | ||
} ); | ||
errorNotice = formatStoreApiErrorMessage( response ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the reason behind declaring errorNotice and replacing it here. What changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to avoid calling addErrorNotice in multiple places. it's done at the end.
I've tested and the offline error is showed as expected but I think the PR introduces a bug: when going to the Checkout block and entering invalid zip code I used to see this error: |
The testing steps did not work for me. Placing an order without an address does not call the /checkout endpoint, because a front-end validation appears. I've tested introducing an invalid zip (Germany, 100000000). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments, I think there is a regression we need to fix.
@ralucaStan can you try now? I think it was the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works as expected. thanks for updating the testing steps as well
* Add error message for fetch errors on checkout * Update message text * revert gitignore change * Remove errorNotice variable
* Add error message for fetch errors on checkout * Update message text * revert gitignore change * Remove errorNotice variable
Adds handling for network errors during the request to
/wc/store/checkout
. Currently it handles API errors (4xx/5xx) but does not factor in other errors like failed requests and offline browsers.Fixes #4894
Screenshots
In offline mode, this is now shown:
Testing
How to test the changes in this Pull Request:
User Facing Testing
Changelog