Skip to main content
Question

How to retrieve customer lifetime revenue data from WooCommerce

  • December 22, 2024
  • 6 replies
  • 27 views

I am trying to update my CRM with customer history lifetime revenue every time an order is placed.  It appears that Total Orders is available but I am not seeing anything regarding total dollars purchased.  I am assuming that there is something that I can do on the Woocommerce side to get that to show up but I just don’t know what.  Please help.  Thank you in advance

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7547 replies
  • December 23, 2024

Hi ​@JamieV121, welcome to the Community! 🎉

I wouldn’t have expected a customer’s total lifetime revenue value to be supplied when the WooCommerce Order trigger runs as that should only return the information for the order that was just placed. As it’s information that relates to the customer rather than the order you might be able to obtain it via a Find Customer WooCommerce search action. But if that doesn’t give access to that information either, then you could try using an API Request (Beta) action to obtain the lifetime revenue amount, assuming WooCommerce’s API allows access to that information via their API. API Request actions are a bit more advanced as you’d need to reference WooCommerce’s API documentation in order to get them set up correctly but we have a general guide on how to use them here which you might find helpful: Set up an API request action

If not, then you could use a Formatter action to add the order value to the existing customer revenue amount that’s in the CRM. To find the existing revenue amount for the customer that’s stored in the CRM you’d need to use a “Find Customer” type of action for the CRM app you’re using, then pass that to the Formatter action. You can learn more about using Formatter to perform calculations here: Use spreadsheet-style formulas in Zaps.

Hope that helps to get you pointed in the right direction. If you run into any issues on that or have further questions do let us know!


  • Author
  • Beginner
  • 3 replies
  • December 23, 2024

I apologize that I was not more clear.  I am currently using a Find Customer and getting all of the information I can which is what is giving me Lifetime number of orders but not total dollars.  I will try the API request.  Thanks,


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7547 replies
  • December 24, 2024

Ah, I see! Thanks for Clarifying that, ​@JamieV121. 🙂

Please do keep us updated on how things go with that API Request action—fingers crossed it’ll do the trick! 🤞


  • Author
  • Beginner
  • 3 replies
  • December 24, 2024

Ok looks like if I use the API request I can pull order history and get a numberic list of all orders which gets me part of the way there, but then I do a formatter math function to try and add all of the numbers to get a total and I get a “The app returned "Invalid Syntax: Only numeric values are allowed".” error so I try to format the data first several different ways but I still get errors.  It seems to be that the problem is that the input is as such 120.12,55.55,12,88.20 etc.  decimal numbers seperated by commas.  Any ideas?


  • Author
  • Beginner
  • 3 replies
  • December 25, 2024

The API request action did produce a list of lifetime order totals for the given customer so thank you for that idea however, I am not sure how to get Zapier to sum total those numbers.  The output from the API action looks something like this.  122.50,55,877.22,33.48 etc.   It is all in one field with the Zapier formatter SUM action does not seem to like.  There is 2 problems.  First, it does not recognize them as numbers so I had to do a “Numbers” “Format Numbers” Formatter action which is fine but he second problem is that the Formatter “Numbers” “Add” Operation does not like all of the numbers being in one field.  I have successfuly split the numbers to separate fields and then did the “Add” but the probem is that I never know how many fields there might be.  Some customers have a history of 100 orders or more.  Is there a way to get the “Add” operation to recognize the numbers being all in one field?  Thank you for your help and Merry Christmas!


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7547 replies
  • January 2, 2025

Sorry for the delay in replying here, ​@JamieV121. I hope you had a wonderful Christmas! 😁 And I’m glad to hear that the API request helped to get the order totals! 🎉 

The output from the API action looks something like this.  122.50,55,877.22,33.48 etc.   It is all in one field with the Zapier formatter SUM action does not seem to like.  There is 2 problems.  First, it does not recognize them as numbers so I had to do a “Numbers” “Format Numbers” Formatter action which is fine but he second problem is that the Formatter “Numbers” “Add” Operation does not like all of the numbers being in one field.  I have successfuly split the numbers to separate fields and then did the “Add” but the probem is that I never know how many fields there might be.  Some customers have a history of 100 orders or more.  Is there a way to get the “Add” operation to recognize the numbers being all in one field?  Thank you for your help and Merry Christmas!

Ah, I expect the numbers that were appearing as though they were in a single field were actually line items.

Formatter has a Utilities action (Line-item to Text) that can be used to convert the line items into a comma separated list of those numbers—see Convert line items into text strings

Then you can select the Output Text field from that Formatter (Utilities) action, that contains the comma separated list of numbers, in your Formatter (Numbers) action:

a4b932016fbd066522e44f9ed32c8280.png
That should allow the Zap to add up all the total amounts, regardless of how many totals there are:

bb7010ceaa0302b97d3f6015557f9b73.png

Can you give that a try and let us know if that works as hoped?