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

Highlighted
Tourist
9 0 0

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.

0 Likes