mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Ensure input element exist before getting value
This commit is contained in:
parent
886a6808b4
commit
d68dc62160
1 changed files with 2 additions and 2 deletions
|
@ -91,8 +91,8 @@ class CardFieldsRenderer {
|
||||||
this.spinner.block();
|
this.spinner.block();
|
||||||
this.errorHandler.clear();
|
this.errorHandler.clear();
|
||||||
|
|
||||||
const paymentToken = document.querySelector('input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked').value
|
const paymentToken = document.querySelector('input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked')?.value
|
||||||
if(paymentToken !== 'new') {
|
if(paymentToken && paymentToken !== 'new') {
|
||||||
fetch(this.defaultConfig.ajax.capture_card_payment.endpoint, {
|
fetch(this.defaultConfig.ajax.capture_card_payment.endpoint, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
credentials: 'same-origin',
|
credentials: 'same-origin',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue