0
[2018-10-30 11:12:36] main.ERROR: Warning: Invalid argument supplied for foreach() in /home/decora/app/code/Digia/AvardaCheckout/Plugin/Model/Quote/QuoteCollectTotalsPrepareItems.php on line 126 {"exception":"[object] (Exception(code: 0): Warning: Invalid argument supplied for foreach() in /home/decora/app/code/Digia/AvardaCheckout/Plugin/Model/Quote/QuoteCollectTotalsPrepareItems.php on line 126 at /home/decora/vendor/magento/framework/App/ErrorHandler.php:61)"} []

protected function prepareItems(CartInterface $subject)
    {
        /** @var \Magento\Quote\Model\Quote\Item $item */
        foreach ($subject->getItems() as $item) {
            if ($item->getData('product_id') === null ||
                $item->getData('parent_item_id') !== null ||
                $item->isDeleted()
            ) {
                continue;
            }

            $itemAdapter = $this->quoteItemAdapterFactory->create([
                'quoteItem' => $item
            ]);
            $itemDataObject = $this->itemDataObjectFactory->create(
                $itemAdapter,
                $item->getQty(),
                $item->getRowTotalInclTax() -
                    $item->getDiscountAmount(),
                $item->getTaxAmount() +
                    $item->getDiscountTaxCompensationAmount() +
                    $item->getWeeeTaxAppliedAmount()
            );

            $this->itemStorage->addItem($itemDataObject);
        }
    }

How can i fix it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.