How to calculate Cart Abandonment Rate
Cart abandonment rate is the share of shopping carts created that never become completed orders.
Formula
Abandonment rate = 1 − (completed orders ÷ carts created) × 100SQL query
This example assumes: carts(id, created_at, session_id), orders(cart_id, status). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.
SELECT DATE_TRUNC('week', c.created_at) AS week,
COUNT(*) AS carts,
COUNT(o.cart_id) AS completed,
100 - COUNT(o.cart_id) * 100.0 / NULLIF(COUNT(*), 0) AS abandonment_pct
FROM carts c
LEFT JOIN orders o ON o.cart_id = c.id AND o.status = 'paid'
WHERE c.created_at < NOW() - INTERVAL '1 day' -- give carts time to complete
GROUP BY 1
ORDER BY 1;Common mistakes that make Cart Abandonment Rate wrong
- Very recent carts have not had time to convert; leave out the last day or so.
- Carts created by returning customers who bought something else earlier are still abandoned carts.
- Test orders and staff carts distort the rate.
Ask for Cart Abandonment Rate in plain English
Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.
- What is our cart abandonment rate by week?
- Which products are most often left in abandoned carts?