do not enqueue script when button is disabled and we are not on checkout

This commit is contained in:
David Remer 2020-08-20 08:45:56 +03:00
parent 234440416c
commit c16bf2594e

View file

@ -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;
}