A Shopify customer lifetime value report in n8n answers the one question your dashboard hides: which customers are actually worth the most over their entire history, not just this week. This guide builds a workflow that pulls every order, sums revenue per customer, ranks your top spenders, writes the full list to Google Sheets, and emails you the top ten every Monday morning. No paid analytics app, no manual export, and it runs on the n8n free tier.
What it does
The workflow runs on a weekly schedule. It fetches all orders from your Shopify store, groups them by customer, and adds up total revenue and order count for each person. It then sorts everyone by lifetime spend, keeps the top twenty, and calculates each customer’s average order value along the way. The ranked list lands in a Google Sheet you can filter and chart, and a formatted HTML email drops the top ten straight into your inbox.
Lifetime value, or CLV, is the total amount a customer has spent with you across every order they have ever placed. Knowing it changes how you spend on retention: a VIP tier, an early-access invite, or a hand-written thank-you note is worth far more aimed at a customer who has spent 4,000 over two years than at a one-time buyer. This report surfaces that list on autopilot.
Why it beats the default
Shopify’s admin shows you lifetime spend one customer at a time. There is no native screen that ranks every customer by total revenue and hands you a sortable list, and the reports that come close sit behind the Shopify or Shopify Plus reporting tiers. Third-party CLV apps solve it but charge a monthly fee and often want to email your customers on your behalf.
The n8n version costs nothing beyond what you already run, keeps your customer data inside your own Google account, and is fully yours to change. Want CLV over the last twelve months instead of all time? Adjust one filter. Want to push the top spenders into a Shopify customer tag or a Klaviyo segment? Add one node. You own the logic, not a vendor.
What you need
- A running n8n instance (self-hosted or n8n Cloud). The free self-hosted tier handles this comfortably.
- A Shopify custom app with Admin API access, created through the 2026 Shopify Dev Dashboard. If you have not connected Shopify to n8n yet, follow connect Shopify to n8n (2026 method) first. You need the
read_ordersandread_customersscopes and a current Admin API version such as 2026-04. - A Google account with Google Sheets, connected to n8n by OAuth2, plus one blank sheet with a header row.
- A Gmail account connected by OAuth2 to send the report email.
Node-by-node list
- Every Monday 8am — Schedule Trigger. A cron expression (
0 8 * * 1) fires the workflow once a week. - Get Shopify Orders — Shopify node, resource Order, operation Get All, Return All enabled, status set to any so paid, fulfilled, and archived orders are all counted.
- Calculate CLV per Customer — Code node. Groups orders by
customer.id, sumstotal_price, counts orders, computes average order value, sorts by total spend, and keeps the top twenty with a rank. - Append to Sheet — Google Sheets node, operation Append, auto-mapping the ranked rows into your sheet.
- Build Email Summary — Code node. Turns the top ten rows into a clean HTML table for the email body.
- Email the Report — Gmail node, operation Send, email type HTML, using the summary as the message.
Step-by-step build
- Create a new workflow in n8n and add a Schedule Trigger. Set the rule to a cron expression and enter
0 8 * * 1so it runs every Monday at 08:00 in your instance timezone. - Add a Shopify node. Select your Shopify credential, set Resource to Order and Operation to Get All. Turn on Return All so pagination is handled for you, and under Options set Status to any. This is the heaviest node, so on a large store expect it to take a minute.
- Add a Code node named Calculate CLV per Customer. Paste the aggregation script (included in the template). It walks every order, skips guest orders with no customer record, keys a running total on the customer id, then returns the top twenty ranked by total spent with an added average order value field.
- Add a Google Sheets node set to Append. Pick your document and sheet, and set the mapping mode to Map Automatically. Give your sheet a header row that matches the field names the Code node outputs: rank, customerId, name, email, orders, totalSpent, avgOrderValue.
- Add a second Code node named Build Email Summary. It reads the appended rows, slices the top ten, and builds an HTML table plus a short intro line into a single output item.
- Add a Gmail node set to Send. Enter your own address in Send To, set Email Type to HTML, and put
{{ $json.html }}in the Message field. Give it a subject like “Weekly Shopify CLV report”. - Run the workflow once by hand with Execute Workflow. Check the sheet fills with a ranked list and the email arrives. Once it looks right, save and toggle the workflow Active so the Monday schedule takes over.
Common mistakes
Counting guest checkouts as separate people. Orders placed without an account have no customer.id, and if you key on email instead you will merge or split people unpredictably. The template skips orders with no customer record so your ranking stays clean.
Forgetting Return All. Without it the Shopify node returns only the first page, usually fifty orders, and your CLV totals silently understate every customer. Always enable Return All for a full-history report.
Header row mismatch in Sheets. Auto-mapping matches input field names to column headers exactly. If your header says “Total Spent” but the field is totalSpent, the column stays empty. Copy the field names verbatim into row one.
Using the wrong price field. total_price includes tax and shipping. If you want product revenue only, switch to subtotal_price in the Code node. Decide once so your trend stays consistent week to week.
Cost at realistic volume
Everything here runs on free tiers. Self-hosted n8n has no per-execution charge, so one weekly run is free regardless of store size. The Shopify Admin API is included with your Shopify plan and the read calls this workflow makes sit far inside the rate limits. Google Sheets and Gmail are free on a standard Google account, and one appended block of rows plus one email per week is nothing against their quotas.
If you run n8n Cloud instead, this is a single scheduled execution per week, comfortably inside the Starter plan’s monthly allowance even alongside your other workflows. For a store doing thousands of orders the only real cost is the extra few seconds the Get All step spends paging through order history, which the schedule absorbs because it runs while you sleep.
Ready-to-import template CTA
Skip the build. The guide above is free to follow end to end. If you would rather not wire six nodes and paste two scripts, the ready-to-import template drops the whole workflow into n8n in under a minute. Import the JSON, plug in your three credentials, set your email address, and activate.
Want it built, connected, and running in your own store without touching n8n? Our done-for-you setup service handles the whole thing.
FAQ
What is customer lifetime value in Shopify?
Customer lifetime value, or CLV, is the total revenue one customer has generated across every order they have ever placed with your store. It is a history metric, not a forecast. This workflow calculates it directly from your real order data, so the number reflects actual spend rather than a modelled estimate.
How is CLV different from RFM segmentation?
RFM scores customers on recency, frequency, and monetary value together to sort them into segments for targeting. CLV is the single monetary figure on its own: total lifetime spend. Use this report to find your highest spenders, and an RFM workflow when you also need recency and frequency to decide who to re-engage.
Can I calculate CLV for only the last 12 months?
Yes. Add a created-at filter to the Shopify Get All node, or filter inside the Code node by comparing each order’s created_at to a cutoff date. A rolling twelve-month window is useful when you want value that reflects recent behaviour rather than a customer’s entire history.
Does this send anything to my customers?
No. The only email goes to you, the store owner, as an internal report. Customer names and emails are read from your orders and written to your own Google Sheet and inbox. Nothing is sent to customers and no data leaves your Google and Shopify accounts.
Will it work on WooCommerce?
The pattern is identical. Swap the Shopify node for the WooCommerce node set to get all orders, then adjust the field names in the Code node to match WooCommerce’s order shape, such as total and the billing email. The aggregation, Sheets append, and Gmail steps stay exactly the same.
Related guides
- n8n Shopify automation: the complete guide
- Shopify RFM customer segmentation with n8n
- Shopify weekly best-sellers report with n8n
- Browse all n8n workflow templates
- More Shopify automation guides