mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +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.standardOrderButtonSelector = '#place_order';
|
||||
|
||||
this.buttonChangeObserver = new MutationObserver((el) => {
|
||||
this.updateUi();
|
||||
});
|
||||
}
|
||||
|
||||
init() {
|
||||
|
@ -64,6 +68,11 @@ class CheckoutBootstap {
|
|||
this.gateway.hosted_fields.wrapper,
|
||||
actionHandler.configuration(),
|
||||
);
|
||||
|
||||
this.buttonChangeObserver.observe(
|
||||
document.querySelector(this.standardOrderButtonSelector),
|
||||
{attributes: true}
|
||||
);
|
||||
}
|
||||
|
||||
updateUi() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue