mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +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.formValid = false;
|
||||
this.currentHostedFieldsInstance = null;
|
||||
this.formSubmissionSubscribed = false;
|
||||
}
|
||||
|
||||
render(wrapper, contextConfig) {
|
||||
|
@ -122,8 +121,7 @@ class CreditCardRenderer {
|
|||
|
||||
});
|
||||
|
||||
const checkoutForm = document.forms.checkout;
|
||||
if(checkoutForm.getAttribute('data-ppcp-subscribed') !== true) {
|
||||
if (document.querySelector(wrapper).getAttribute('data-ppcp-subscribed') !== true) {
|
||||
document.querySelector(wrapper + ' button').addEventListener(
|
||||
'click',
|
||||
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