diff --git a/mollie.php b/mollie.php index 4e7c91505..23c6c6b20 100755 --- a/mollie.php +++ b/mollie.php @@ -26,6 +26,7 @@ use Mollie\Repository\PaymentMethodRepositoryInterface; use Mollie\Service\ExceptionService; use Mollie\ServiceProvider\LeagueServiceContainerProvider; +use Mollie\Subscription\Config\Config as SubscriptionConfig; use Mollie\Subscription\Handler\CustomerAddressUpdateHandler; use Mollie\Subscription\Handler\UpdateSubscriptionCarrierHandler; use Mollie\Subscription\Install\AttributeInstaller; @@ -1124,6 +1125,20 @@ 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); + + // Note: groups = ['attribute_group_id => 'attribute_id'] + if (!array_key_exists($subscriptionGroup, $groups)) { + return; + } + $response = json_decode($params['value'], true); $hasError = $response['hasError'] ?? false;