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

ErrorHandler removes other notice messages in add-payment-method page #2796

Open
gedex opened this issue Nov 15, 2024 · 0 comments
Open

ErrorHandler removes other notice messages in add-payment-method page #2796

gedex opened this issue Nov 15, 2024 · 0 comments

Comments

@gedex
Copy link
Member

gedex commented Nov 15, 2024

Describe the Bug

This JS, enqueued in add-payment-method page, clear out all notices added via wc_add_notice():

} ).then( ( paypal ) => {
const errorHandler = new ErrorHandler(
ppcp_add_payment_method.labels.error.generic,
document.querySelector( '.woocommerce-notices-wrapper' )
);
errorHandler.clear();

specifically

errorHandler.clear();

Notice appears for a second — due to the setTimeout — and then cleared.

To Reproduce

Use following test to create a custom error notice (in a real case, this could be from another plugin):

add_filter( 'woocommerce_add_payment_method_form_is_valid', function() {
	wc_add_notice( 'Test custom error notice', 'error' );
	return false;
} );

Go to add-payment-method page and see it appears for a split second.

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

No branches or pull requests

1 participant