Magento 2 troubleshooting › Customers
How do I find abandoned carts in Magento?
Short answer: Carts are stored in quote. An active quote with items that hasn't become an order is an abandoned cart. Magento's report shows registered customers only; the query includes guests who entered an email.
Check it step by step
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
Carts with items, idle for over an hour, from the last 7 days
Works on Magento Open Source and Adobe Commerce:
SELECT q.entity_id AS quote_id, q.customer_email, q.customer_id IS NOT NULL AS registered,
q.items_count, q.items_qty, ROUND(q.base_grand_total, 2) AS cart_value, q.updated_at
FROM quote q
WHERE q.is_active = 1
AND q.items_count > 0
AND q.reserved_order_id IS NULL
AND q.updated_at BETWEEN NOW() - INTERVAL 7 DAY AND NOW() - INTERVAL 1 HOUR
ORDER BY cart_value DESC
LIMIT 100;
What's in them
Works on Magento Open Source and Adobe Commerce:
SELECT qi.sku, qi.name, COUNT(DISTINCT q.entity_id) AS carts, SUM(qi.qty) AS units
FROM quote q
JOIN quote_item qi ON qi.quote_id = q.entity_id AND qi.parent_item_id IS NULL
WHERE q.is_active = 1
AND q.items_count > 0
AND q.updated_at >= NOW() - INTERVAL 7 DAY
GROUP BY qi.sku, qi.name
ORDER BY carts DESC
LIMIT 25;
How to fix it
- The built-in report is Reports › Marketing › Abandoned Carts (registered customers only).
- Quotes are deleted after Stores › Configuration › Sales › Checkout › Shopping Cart › Quote Lifetime (days), 30 by default, by cron.
- Emailing guests about their cart needs their consent under GDPR and similar laws; check before you build a reminder.