1

I'm trying to get quote on checkout and this exception is thrown in

vendor\magento\module-checkout\Model\Session.php:241

exception.log

Message: Infinite loop detected, review the trace for the looping path 
{"exception":"[object] (Exception(code: 0): Report ID: webapi-
6e4533bg2n381; Message: Infinite loop detected, review the trace for the 
looping path at /public_html/vendor/magento/framework/Webapi
/ErrorProcessor.php:208, LogicException(code: 0): Infinite loop detected,
review the trace for the looping path at /public_html/vendor/magento
/module-checkout/Model/Session.php:241)"} []

The problem is in overridden \Magento\Tax\Model\Config getShippingTaxClass() where I use

$cart = $objectManager->get('\Magento\Checkout\Model\Cart'); 
$quote = $cart->getQuote();
$itemsCollection = $quote->getItemsCollection();

and this triggers the exception. There is no loop around it.

What would be to correct way of getting cart items in 2.3.4?

3
  • Found any fix for this?
    – Olivier
    Commented May 27, 2020 at 15:14
  • @Olivier yes, I added my answer.
    – Alan
    Commented May 31, 2020 at 8:15
  • Any solution for the same I am facing the same issue after m2.3.3 upgrade 2.3.5 EE Commented Sep 23, 2020 at 11:32

1 Answer 1

12

Getting items directly from session was causing this error so I only got quote id from session and then used CartRepositoryInterface to retrieve items.

$session = $objectManager->get('\Magento\Checkout\Model\Session');
$quote_repository = $objectManager->get('\Magento\Quote\Api\CartRepositoryInterface');
$qid = $session->getQuoteId();
$quote = $quote_repository->get($qid);      
// retrieve quote items
$items = $quote->getAllItems();
2
  • 1
    superb @Alan working for me... good job Commented Jun 24, 2020 at 9:17
  • It working thanks.. Commented Aug 20, 2020 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.