mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-12 01:18:39 +08:00
Use hosted fields button wrapper instead of checkout form to add the attribute
This commit is contained in:
parent
ef99e53d6a
commit
635838c636
1 changed files with 12 additions and 14 deletions
|
@ -9,7 +9,6 @@ class CreditCardRenderer {
|
||||||
this.cardValid = false;
|
this.cardValid = false;
|
||||||
this.formValid = false;
|
this.formValid = false;
|
||||||
this.currentHostedFieldsInstance = null;
|
this.currentHostedFieldsInstance = null;
|
||||||
this.formSubmissionSubscribed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(wrapper, contextConfig) {
|
render(wrapper, contextConfig) {
|
||||||
|
@ -122,8 +121,7 @@ class CreditCardRenderer {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkoutForm = document.forms.checkout;
|
if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {
|
||||||
if(checkoutForm.getAttribute('data-ppcp-subscribed') !== true) {
|
|
||||||
document.querySelector(wrapper + ' button').addEventListener(
|
document.querySelector(wrapper + ' button').addEventListener(
|
||||||
'click',
|
'click',
|
||||||
event => {
|
event => {
|
||||||
|
@ -132,7 +130,7 @@ class CreditCardRenderer {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
checkoutForm.setAttribute('data-ppcp-subscribed', true);
|
document.querySelector(wrapper).setAttribute('data-ppcp-subscribed', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue