I am experiencing an "Item qty Declaration Error" in Magento when a logged-in user adds items to the cart.

Unexpectedly, the "Item qty Declaration Error" message is shown with every cart item, but only for logged-in users.

Item qty Declaration Error

Non-logged-in or guest users do not encounter this error.

No Error in NonLoggedIn User

Steps taken:

  1. I investigated the code and found that the error originates from the checkdata() function in vendor\magento\module-quote\Model\Quote\Item\AbstractItem.php when the setQty() function is called.
  2. I added a print statement to display the exception message, and it revealed the error message "Infinite loop detected, review the trace for the looping path."
  3. The error seems to be caused by the use of the setQty().

Error Throwing Code

Expected Outcome:
I expected the "Item qty Declaration Error" to not occur when logged-in users add items to the cart.

Additional information:

  • Magento version: 2.4.5
  • Theme: Claue Theme
  • Minimum Quantity: 0.5 (Allow Decimal Qty:Yes)


Your Answer

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

Browse other questions tagged or ask your own question.