importerFactory = $importerFactory; $this->helper = $data; $this->storeManager = $storeManagerInterface; } /** * Execute method. * * @param \Magento\Framework\Event\Observer $observer * * @return $this */ public function execute(\Magento\Framework\Event\Observer $observer) { $order = $observer->getEvent()->getOrder(); $incrementId = $order->getIncrementId(); $websiteId = $this->storeManager->getStore($order->getStoreId()) ->getWebsiteId(); $orderSync = $this->helper->isOrderSyncEnabled($websiteId); if ($this->helper->isEnabled($websiteId) && $orderSync) { //register in queue with importer $this->importerFactory->create() ->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS, [$incrementId], \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE_DELETE, $websiteId ); } return $this; } }