Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Finding if a customer is first time or returning customer per order via API

Finding if a customer is first time or returning customer per order via API

annapurna
Tourist
12 0 4

Hi, 

Let's say a customer has made 5 orders. How do you find which is the first order that the customer made? I found that when Shopify creates sales report and upon splitting by customer id and customer type (first time vs returning). The same customer can be a first time customer for order A (the first order) and a returning customer for order B. 

 

But when we query order A -> The API response contains order_counts -> 2 and according to this document here 

 

https://help.shopify.com/en/manual/reports-and-analytics/shopify-reports/report-types/customers-reports#first-time-vs-returning-customer-sales 

 

, a customer that has two or more than 2 orders is a returning customer. 

After order B is created, "customer": {"orders_count": 2, for both orders A and B, thus the customer is returning customer. However, in the UI, the same customer is a first time customer for order A and a returning customer for order B. Is there a way to tell if a customer is a returning customer or first-time customer per order?

Or tell if an order is the first order a customer ever made. Shopify internally certainly has that data but this is causing discrepancy when exporting data via API to third-party tools to create sales reports.

Replies 2 (2)

roomtemperature
Shopify Partner
1 0 1

Hi! Any updates on this? Could you solve this problem? I find it very weird that the API doesn't include that information clearly.

Tonegolf71
Shopify Partner
12 0 6

Any news on this one? I have the same issue.

 

As this is missing, the only thing I thought of doing was creating a script that would crawl each customer in turn, then get their earliest order and set a "Customer 1st Order" tag against that order.

 

There are apps that can set a "Customer 1st Order" tag as orders are placed, which is great for going forward, but I don't see anyone out there doing it retrospectively?