Magento – Item (Magento\Framework\View\Element\UiComponent\DataProvider\Document) with the same ID “2” already exists

magento-2.1magento2orderssales-order

I cleared my test orders from Magento 2 with these steps:
https://stackoverflow.com/questions/37861046/how-to-remove-test-orders-from-magento2

However when I go to Sales->Orders at first it works. But after I create my second order the page gives an error msg:

Item (Magento\Framework\View\Element\UiComponent\DataProvider\Document) with the same ID "2" already exists.

How to solve this error?

Best Answer

I was having the same issue today, it was due to 3rd party extensions/modules adding attributes to the orders. I didn't truncate those tables on the first run, that's why we were seeing the issue. As soon as I did that, everything went back to normal.

Make sure there aren't any other extensions/modules creating attributes that are related to orders, or tables that are referencing the orders.

Related Topic