totalCollector = $totalCollector; $this->totalCollectorFactory = $totalCollectorFactory; $this->eventManager = $eventManager; $this->storeManager = $storeManager; $this->totalFactory = $totalFactory; } /** * @param int $storeId * @return Collector */ private function getTotalCollector($storeId) { if ($this->totalCollector === null) { $store = $this->storeManager->getStore($storeId); $this->totalCollector = $this->totalCollectorFactory->create( ['store' => $store] ); } return $this->totalCollector; } /** * @param int $storeId * @return \Magento\Quote\Model\Quote\Address\Total\AbstractTotal[] */ public function getCollectors($storeId) { return $this->getTotalCollector($storeId)->getCollectors(); } }