mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Ensure change payment method only submit card fields for new payment
This commit is contained in:
parent
0262c28580
commit
dfd3f0cbe9
1 changed files with 7 additions and 0 deletions
|
@ -198,6 +198,13 @@ document.addEventListener(
|
|||
}
|
||||
|
||||
document.querySelector('#place_order')?.addEventListener("click", (event) => {
|
||||
if (
|
||||
getCurrentPaymentMethod() !== 'ppcp-credit-card-gateway'
|
||||
|| document.querySelector('input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked')?.value !== 'new'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
cardField.submit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue