Created
November 13, 2020 19:11
-
-
Save salsalabs/ff5187399d88c88ff837f191468a8103 to your computer and use it in GitHub Desktop.
Wait for the payment option block to appear then delete it. Solves an issue with a misconfigured PayPal account.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- SalsaStaff 365924: BEGIN delete the payment option fieldset that holds the PayPal payment option. --> | |
<script type="text/javascript"> | |
document.addEventListener("DOMContentLoaded", () => { | |
// select the target node | |
var target = document.querySelector("#salsa"); | |
// create an observer instance | |
var observer = new MutationObserver(function (mutations) { | |
mutations.forEach(function (mutation) { | |
console.log(mutation.type); | |
}); | |
// Remove the payment type if it has been added. | |
var unwanted = document.querySelector('fieldset.payment-type'); | |
if (unwanted != null) { | |
unwanted.parentNode.removeChild(unwanted); | |
observer.disconnect(); | |
} | |
}); | |
// configuration of the observer: | |
var config = { childList: true } | |
// pass in the target node, as well as the observer options | |
observer.observe(target, config); | |
}); | |
</script> | |
<!-- SalsaStaff 365924: END delete the payment option fieldset that holds the PayPal payment option. --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment