I'm working on an integration that reads data from a Magento2 database and the final aim is to send order data, products and the relation between products (line_item) to a third party service via API.

The database has thousands of orders, but none of them has relation for quote and quote_item, so I cannot reconstruct which products have been purchased.

I've been told by them that it's normal to have quote and quote_item tables to be purged so it's normal I can't rely on that data.

I've read about it here, https://docs.magento.com/mbi/data-analyst/data-warehouse-mgr/sales-flat-quote-item-table.html but it looks that the best practice is to have the data purged only for abandoned carts and similar, not for confirmed and processed orders.

I need to know if the database I'm connecting to is using best practice or they are doing something very specific and unusual by deleting all quote and quote_item data.

1 Answer 1


First, take a look on

  • cron job class \Magento\Sales\Cron\CleanExpiredQuotes
  • Model class: \Magento\Sales\Model\ResourceModel\Collection\ExpiredQuotesCollection

and these classes are responsible for clearing data form quote and quote_items table data.

Magento is delete the quote data based on admin setting and a Quote is considered expired if the latest update date of the quote is greater than lifetime threshold.

  • ok then what tables should I read to find order data for confirmed orders? Sep 29, 2021 at 12:34
  • 1
    You can get all the confirmed orders information from sales_order, sales_order_item, sales_order_address tables Sep 29, 2021 at 12:36

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.