Skip to content

Commit

Permalink
Merge pull request #996 from mollie/PIPRES-488/product-add-bug
Browse files Browse the repository at this point in the history
PIPRES-488: added additional validation then adding the product which…
  • Loading branch information
GytisZum authored Dec 9, 2024
2 parents 4ec585c + b7328a2 commit 64a8452
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 64a8452

Please sign in to comment.