Skip to content

Commit

Permalink
Merge pull request #2794 from woocommerce/PCP-3863-Disable-Add_paymen…
Browse files Browse the repository at this point in the history
…t_method-button-when-saving-payment

Disable "Add payment method" button while adding card
  • Loading branch information
Dinamiko authored Nov 20, 2024
2 parents a83dffa + c1dbb83 commit 04969f0
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ import {
renderFields( cardFields );
}

document
.querySelector( '#place_order' )
?.addEventListener( 'click', ( event ) => {
const placeOrderButton = document.querySelector( '#place_order' );
placeOrderButton?.addEventListener( 'click', ( event ) => {
const cardPaymentToken = document.querySelector(
'input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked'
)?.value;
Expand All @@ -95,11 +94,11 @@ import {
) {
return;
}

placeOrderButton.disabled = true;
event.preventDefault();

cardFields.submit().catch( ( error ) => {
console.error( error );
placeOrderButton.disabled = false;
} );
} );
} );
Expand Down

0 comments on commit 04969f0

Please sign in to comment.