Model/Rules.php
public function process($collection, $type, $websiteId)
    {
        $this->ruleType = $type;
        $emailRules = $this->getActiveRuleForWebsite($type, $websiteId);

        //if no rule or condition then return the collection untouched
        if (empty($emailRules)) {
            return $collection;
        }
        $condition = $this->serializer->unserialize($emailRules->getConditions());
        if (empty($condition)) {
            return $collection;
        }

        //process rule on collection according to combination
        $combination = $emailRules->getCombination();
        //join tables to collection according to type
        $collection = $this->rulesResource->joinTablesOnCollectionByType($collection, $type);

        if ($combination == self::COMBINATION_TYPE_ALL) {
            $collection = $this->processAndCombination($collection, $condition);
        }

        if ($combination == self::COMBINATION_TYPE_ANY) {
            $collection = $this->processOrCombination($collection, $condition);
        }

        return $collection;
    }
public function process($collection, $type, $websiteId)
    {
        $this->ruleType = $type;
        $emailRules = $this->getActiveRuleForWebsite($type, $websiteId);

        //if no rule or condition then return the collection untouched
        if (empty($emailRules)) {
            return $collection;
        }
        $condition = $this->serializer->unserialize($emailRules->getConditions());
        if (empty($condition)) {
            return $collection;
        }

        //process rule on collection according to combination
        $combination = $emailRules->getCombination();
        //join tables to collection according to type
        $collection = $this->rulesResource->joinTablesOnCollectionByType($collection, $type);

        if ($combination == self::COMBINATION_TYPE_ALL) {
            $collection = $this->processAndCombination($collection, $condition);
        }

        if ($combination == self::COMBINATION_TYPE_ANY) {
            $collection = $this->processOrCombination($collection, $condition);
        }

        return $collection;
    }
public function process ( $ collection , $ type , $ websiteId ) { $ this -> ruleType = $ type ; $ emailRules = $ this -> getActiveRuleForWebsite ( $ type , $ websiteId ) ; //if no rule or condition then return the collection untouched if ( empty ( $ emailRules ) ) { return $ collection ; } $ condition = $ this -> serializer -> unserialize ( $ emailRules -> getConditions ( ) ) ; if ( empty ( $ condition ) ) { return $ collection ; } //process rule on collection according to combination $ combination = $ emailRules -> getCombination ( ) ; //join tables to collection according to type $ collection = $ this -> rulesResource -> joinTablesOnCollectionByType ( $ collection , $ type ) ; if ( $ combination == self :: COMBINATION_TYPE_ALL ) { $ collection = $ this -> processAndCombination ( $ collection , $ condition ) ; } if ( $ combination == self :: COMBINATION_TYPE_ANY ) { $ collection = $ this -> processOrCombination ( $ collection , $ condition ) ; } return $ collection ; }
Process rule on collection.

@param \Magento\Sales\Model\ResourceModel\Order\Collection|
\Magento\Quote\Model\ResourceModel\Quote\Collection $collection
@param string $type
@param int $websiteId

@return \Magento\Sales\Model\ResourceModel\Order\Collection|
\Magento\Quote\Model\ResourceModel\Quote\Collection $collection
Process rule on collection .