mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Prevent PayPal subscription buttons to be rendered multiple times
This commit is contained in:
parent
be8015b8dd
commit
02e35bbe9d
1 changed files with 7 additions and 0 deletions
|
@ -22,6 +22,8 @@ class SingleProductBootstap {
|
|||
this.renderer.onButtonsInit(this.gateway.button.wrapper, () => {
|
||||
this.handleChange();
|
||||
}, true);
|
||||
|
||||
this.subscriptionButtonsLoaded = false
|
||||
}
|
||||
|
||||
form() {
|
||||
|
@ -29,6 +31,8 @@ class SingleProductBootstap {
|
|||
}
|
||||
|
||||
handleChange() {
|
||||
this.subscriptionButtonsLoaded = false
|
||||
|
||||
if (!this.shouldRender()) {
|
||||
this.renderer.disableSmartButtons(this.gateway.button.wrapper);
|
||||
hide(this.gateway.button.wrapper, this.formSelector);
|
||||
|
@ -187,6 +191,7 @@ class SingleProductBootstap {
|
|||
return;
|
||||
}
|
||||
|
||||
if(this.subscriptionButtonsLoaded) return
|
||||
loadPaypalJsScript(
|
||||
{
|
||||
clientId: PayPalCommerceGateway.client_id,
|
||||
|
@ -197,6 +202,8 @@ class SingleProductBootstap {
|
|||
actionHandler.subscriptionsConfiguration(subscription_plan),
|
||||
this.gateway.button.wrapper
|
||||
);
|
||||
|
||||
this.subscriptionButtonsLoaded = true
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue