-
Notifications
You must be signed in to change notification settings - Fork 50
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
Execute server-side WC validation when clicking button #942
Conversation
Otherwise old messages may get stuck
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.
Looks good, only a few imports that seems not needed.
onError: () => { | ||
this.errorHandler.genericError(); | ||
onError: (err) => { | ||
console.error(err); |
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.
Is this console error on purpose here?
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.
Yes, we don't show it on the page, so should show it at least in console if it comes from other sources.
Added execution of WC
validate_checkout
during order creation.This should be better than the basic JS validation #513, but it is still done in a bit non-standard/hacky way, may break depending on other plugins using the hooks, WC version (the method is not the public API, though hopefully
protected
is close enough to that and unlikely to have breaking changes) etc. There is a filter for disabling it. Also we catch/log the (non-validation) errors during the validation execution, if this happens it will be skipped and continue like before #513. The JS validation also remains for now, but disabled by default.Also fixed
errorHandler
s in JS, there were multiple instances of these objects creating their own error lists on the page, which was resulting in outdated messages still being present in some cases.And it seems like after bb86f1b the order creation errors were replaced by the generic message (though probably not just this commit because after simply reverting it the messages were still broken), so fixed this too.