mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Use MutationObserver to detect order button visibility changes
Such as for the old PayPal plugin, which shows it on click + with some animation, or Conditional WooCommerce Checkout Field, which shows the button after loading some data
This commit is contained in:
parent
3dc9b48e1b
commit
9c7859bf35
1 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,10 @@ class CheckoutBootstap {
|
||||||
this.spinner = spinner;
|
this.spinner = spinner;
|
||||||
|
|
||||||
this.standardOrderButtonSelector = '#place_order';
|
this.standardOrderButtonSelector = '#place_order';
|
||||||
|
|
||||||
|
this.buttonChangeObserver = new MutationObserver((el) => {
|
||||||
|
this.updateUi();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
@ -64,6 +68,11 @@ class CheckoutBootstap {
|
||||||
this.gateway.hosted_fields.wrapper,
|
this.gateway.hosted_fields.wrapper,
|
||||||
actionHandler.configuration(),
|
actionHandler.configuration(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.buttonChangeObserver.observe(
|
||||||
|
document.querySelector(this.standardOrderButtonSelector),
|
||||||
|
{attributes: true}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUi() {
|
updateUi() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue