config = $config; $this->canApplyMsrp = $canApplyMsrp; $this->msrp = $msrp; } /** * Set Quote information about MSRP price enabled * * @param \Magento\Framework\Event\Observer $observer * @return void */ public function execute(\Magento\Framework\Event\Observer $observer) { /** @var $quote \Magento\Quote\Model\Quote */ $quote = $observer->getEvent()->getQuote(); $canApplyMsrp = false; if ($this->config->isEnabled()) { foreach ($quote->getAllAddresses() as $address) { if ($this->canApplyMsrp->isCanApplyMsrp($address)) { $canApplyMsrp = true; break; } } } $this->msrp->setCanApplyMsrp($quote->getId(), $canApplyMsrp); } }