Merge pull request #1910 from woocommerce/PCP-2471-hosted-card-fields-payment-not-possible-when-vaulting-is-active-and-user-does-not-have-a-saved-payment-method

Hosted card fields payment not possible when Vaulting is active and user does not have a saved payment method (2466)
This commit is contained in:
Emili Castells 2023-12-18 14:52:43 +01:00 committed by GitHub
commit cceb057ed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,8 +92,8 @@ class CardFieldsRenderer {
this.spinner.block();
this.errorHandler.clear();
const paymentToken = document.querySelector('input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked').value
if(paymentToken !== 'new') {
const paymentToken = document.querySelector('input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked')?.value
if(paymentToken && paymentToken !== 'new') {
fetch(this.defaultConfig.ajax.capture_card_payment.endpoint, {
method: 'POST',
credentials: 'same-origin',