mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
do not load script when no fields to render
This commit is contained in:
parent
c663fca067
commit
21937aaf52
1 changed files with 6 additions and 1 deletions
|
@ -53,7 +53,12 @@ document.addEventListener(
|
|||
console.error('PayPal button could not be configured.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
! document.querySelector(PayPalCommerceGateway.button.wrapper) &&
|
||||
! document.querySelector(PayPalCommerceGateway.hosted_fields.wrapper)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const script = document.createElement('script');
|
||||
|
||||
script.setAttribute('src', PayPalCommerceGateway.button.url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue