From 38d861ac1e3537bb71e3500306ca32c06e76fd55 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 18 Nov 2024 16:48:39 +0200 Subject: [PATCH] PIPRES-488: added additional validation then adding the product which causes incorrect behavior on some themes --- mollie.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mollie.php b/mollie.php index 4e7c91505..fa475f108 100755 --- a/mollie.php +++ b/mollie.php @@ -32,6 +32,7 @@ use Mollie\Subscription\Install\DatabaseTableInstaller; use Mollie\Subscription\Install\HookInstaller; use Mollie\Subscription\Install\Installer; +use Mollie\Subscription\Config\Config as SubscriptionConfig; use Mollie\Subscription\Provider\SubscriptionProductProvider; use Mollie\Subscription\Repository\LanguageRepository as LanguageAdapter; use Mollie\Subscription\Repository\RecurringOrderRepositoryInterface; @@ -1124,6 +1125,19 @@ public function hookActionAjaxDieCartControllerDisplayAjaxUpdateBefore(array $pa return; } + $isSubscriptionEnabled = Configuration::get(Config::MOLLIE_SUBSCRIPTION_ENABLED); + + $groups = Tools::getValue('group'); + if (!(bool)$isSubscriptionEnabled || !is_array($groups)) { + return; + } + + $subscriptionGroup = Configuration::get(SubscriptionConfig::SUBSCRIPTION_ATTRIBUTE_GROUP); + + if (!in_array($subscriptionGroup, $groups, true)) { + return; + } + $response = json_decode($params['value'], true); $hasError = $response['hasError'] ?? false;