* Fix 'Invalid payment method' error upon double click 'Delete' #30862 An 'Invalid payment method' error shows when a user double clicks the 'Delete' button in the 'Add Payment method screen'. Every time the user clicks the button, there is a GET request to delete the payment method. First request is handled correctly, but subsequent requests throw an error, because the payment method cannot be found since it was already deleted. This adds an event handler to disable the button on the first click. * Add changelog entry
This commit is contained in:
parent
976e2f9e0b
commit
c20f58e16a
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix 'Invalid payment method' error upon double click on Delete button of Payment methods table
|
|
@ -32,4 +32,13 @@ jQuery( function( $ ) {
|
|||
|
||||
$( document.body ).trigger( 'init_add_payment_method' );
|
||||
|
||||
// Prevent firing multiple requests upon double clicking the buttons in payment methods table
|
||||
$(' .woocommerce .payment-method-actions .button.delete' ).on( 'click' , function( event ) {
|
||||
if ( $( this ).hasClass( 'disabled' ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
$( this ).addClass( 'disabled' );
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue