mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Check if the buttons are there before rendering it
In some cases WC replaces the checkout form only partially leaving the buttons there
This commit is contained in:
parent
d31987ed46
commit
fe2d7d170f
1 changed files with 8 additions and 0 deletions
|
@ -1,10 +1,18 @@
|
|||
class Renderer {
|
||||
render(wrapper, buttonConfig) {
|
||||
if (this.isAlreadyRendered(wrapper)) {
|
||||
return;
|
||||
}
|
||||
|
||||
paypal.Buttons(
|
||||
buttonConfig,
|
||||
).render(wrapper);
|
||||
}
|
||||
|
||||
isAlreadyRendered(wrapper) {
|
||||
return document.querySelector(wrapper).hasChildNodes();
|
||||
}
|
||||
|
||||
hideButtons(element) {
|
||||
document.querySelector(element).style.display = 'none';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue