From c16bf2594e1c9d8cffe3fc86c8fd1346bd9eb021 Mon Sep 17 00:00:00 2001 From: David Remer Date: Thu, 20 Aug 2020 08:45:56 +0300 Subject: [PATCH] do not enqueue script when button is disabled and we are not on checkout --- modules.local/ppcp-button/src/Assets/SmartButton.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules.local/ppcp-button/src/Assets/SmartButton.php b/modules.local/ppcp-button/src/Assets/SmartButton.php index 7436ff4ac..a44cc632e 100644 --- a/modules.local/ppcp-button/src/Assets/SmartButton.php +++ b/modules.local/ppcp-button/src/Assets/SmartButton.php @@ -203,6 +203,10 @@ class SmartButton implements SmartButtonInterface public function enqueue(): bool { + $buttonsEnabled = $this->settings->has('enabled') && $this->settings->get('enabled'); + if (! is_checkout() && !$buttonsEnabled) { + return false; + } if (! $this->canSaveVaultToken() && $this->hasSubscription()) { return false; }