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
11 0 5

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?