* [ * 'ProductType1' => true, * 'ProductType2' => false * ] * */ public function __construct( array $productTypeChildrenValidationMap = [] ) { $this->productTypeChildrenValidationMap = $productTypeChildrenValidationMap; } /** * Checks necessity to validate rule on item's children. * * @param QuoteItem $item * @return bool */ public function isChildrenValidationRequired(QuoteItem $item): bool { $type = $item->getProduct()->getTypeId(); if (isset($this->productTypeChildrenValidationMap[$type])) { return (bool)$this->productTypeChildrenValidationMap[$type]; } return true; } }