do not load script when no fields to render

This commit is contained in:
David Remer 2020-07-10 11:10:23 +03:00
parent c663fca067
commit 21937aaf52

View file

@ -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);