From c13ac3ab733dca374d60f9196f669962186f4381 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Thu, 20 Jul 2023 14:29:37 +0200 Subject: [PATCH] Disable buttons in cart and checkout pages when no subscription plan exists --- .../resources/js/modules/ContextBootstrap/CartBootstap.js | 6 ++++++ .../js/modules/ContextBootstrap/CheckoutBootstap.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js b/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js index 5aadb7f61..126c28d08 100644 --- a/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js +++ b/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js @@ -77,6 +77,12 @@ class CartBootstrap { && PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled ) { this.renderer.render(actionHandler.subscriptionsConfiguration()); + + if(!PayPalCommerceGateway.subscription_plan_id) { + this.gateway.button.is_disabled = true; + this.handleButtonStatus(); + } + return; } diff --git a/modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstap.js b/modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstap.js index db1cba84f..ab75d1c16 100644 --- a/modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstap.js +++ b/modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstap.js @@ -107,6 +107,12 @@ class CheckoutBootstap { && PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled ) { this.renderer.render(actionHandler.subscriptionsConfiguration(), {}, actionHandler.configuration()); + + if(!PayPalCommerceGateway.subscription_plan_id) { + this.gateway.button.is_disabled = true; + this.handleButtonStatus(); + } + return; }