SQL templates/PrestaShop

Customer lifetime value in PrestaShop

Average lifetime spend per PrestaShop customer across all valid orders.

PrestaShop · PostgreSQL
SELECT ROUND(AVG(spent), 2) AS avg_lifetime_value
FROM (
  SELECT id_customer, SUM(total_paid_tax_incl) AS spent
  FROM ps_orders
  WHERE valid = 1
  GROUP BY id_customer
) x;

How it works

Totals each customer's valid-order revenue, then averages across customers — your average customer lifetime value (CLV/LTV). Run it on the clone so the full-table scan never slows your shop.

Run this on your own database

BeQuery mirrors your PrestaShop MySQL database to an isolated PostgreSQL copy, so you can run queries like this one without ever touching production.

Start free No credit card