diff --git a/Model/SalesRuleValidator.php b/Model/SalesRuleValidator.php index 2af9132..d40d25b 100644 --- a/Model/SalesRuleValidator.php +++ b/Model/SalesRuleValidator.php @@ -32,13 +32,15 @@ public function __construct(Request $request, SystemConfig $systemConfig) } /** - * @param Rule $rule - * @param string $couponCode + * @param Rule $rule + * @param array $couponCode * @return bool */ - public function isValid(Rule $rule, string $couponCode): bool + public function isValid(Rule $rule, array $couponCode): bool { - if ($rule->getData('is_grin_only') && ($rule->getPrimaryCoupon()->getCode() === $couponCode)) { + $code = $rule->getPrimaryCoupon()->getCode(); + + if ($code !== null && $rule->getData('is_grin_only') && in_array($code, $couponCode)) { return $this->request->getHeader(self::TOKEN_HEADER) === $this->systemConfig->getSalesRuleToken(); } diff --git a/Plugin/Magento/SalesRule/Model/RulesApplier/ValidateByToken.php b/Plugin/Magento/SalesRule/Model/RulesApplier/ValidateByToken.php index 8e826cd..381f589 100644 --- a/Plugin/Magento/SalesRule/Model/RulesApplier/ValidateByToken.php +++ b/Plugin/Magento/SalesRule/Model/RulesApplier/ValidateByToken.php @@ -41,7 +41,7 @@ public function aroundApplyRules( $couponCode ): array { foreach ($rules as $rule) { - if (!$this->salesRuleValidator->isValid($rule, (string) $couponCode)) { + if (!$this->salesRuleValidator->isValid($rule, $couponCode)) { return $proceed($item, [], $skipValidation, $couponCode); } }