Controller/Email/Getbasket.php
private function checkMissingAndAdd()
    {
        /** @var \Magento\Checkout\Model\Session $checkoutSession */
        $checkoutSession = $this->checkoutSession->create();
        $currentQuote = $checkoutSession->getQuote();

        if ($currentQuote->hasItems()) {
            $currentSessionItems = $currentQuote->getAllItems();
            $currentItemIds = [];

            foreach ($currentSessionItems as $currentSessionItem) {
                $currentItemIds[] = $currentSessionItem->getId();
            }
            /** @var \Magento\Quote\Model\Quote\Item $item */
            foreach ($this->quote->getAllItems() as $item) {
                if (!in_array($item->getId(), $currentItemIds)) {
                    $currentQuote->addItem($item);
                }
            }
            $currentQuote->collectTotals();

            $this->quoteResource->save($currentQuote);
        }
    }
private function checkMissingAndAdd()
    {
        /** @var \Magento\Checkout\Model\Session $checkoutSession */
        $checkoutSession = $this->checkoutSession->create();
        $currentQuote = $checkoutSession->getQuote();

        if ($currentQuote->hasItems()) {
            $currentSessionItems = $currentQuote->getAllItems();
            $currentItemIds = [];

            foreach ($currentSessionItems as $currentSessionItem) {
                $currentItemIds[] = $currentSessionItem->getId();
            }
            /** @var \Magento\Quote\Model\Quote\Item $item */
            foreach ($this->quote->getAllItems() as $item) {
                if (!in_array($item->getId(), $currentItemIds)) {
                    $currentQuote->addItem($item);
                }
            }
            $currentQuote->collectTotals();

            $this->quoteResource->save($currentQuote);
        }
    }
private function checkMissingAndAdd ( ) { /** @var \Magento\Checkout\Model\Session $checkoutSession */ $ checkoutSession = $ this -> checkoutSession -> create ( ) ; $ currentQuote = $ checkoutSession -> getQuote ( ) ; if ( $ currentQuote -> hasItems ( ) ) { $ currentSessionItems = $ currentQuote -> getAllItems ( ) ; $ currentItemIds = [ ] ; foreach ( $ currentSessionItems as $ currentSessionItem ) { $ currentItemIds [ ] = $ currentSessionItem -> getId ( ) ; } /** @var \Magento\Quote\Model\Quote\Item $item */ foreach ( $ this -> quote -> getAllItems ( ) as $ item ) { if ( ! in_array ( $ item -> getId ( ) , $ currentItemIds ) ) { $ currentQuote -> addItem ( $ item ) ; } } $ currentQuote -> collectTotals ( ) ; $ this -> quoteResource -> save ( $ currentQuote ) ; } }
Check missing items from current quote and add.

@return null
Check missing items from current quote and add .