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.

Creating a query for all products bought by a customer?

Creating a query for all products bought by a customer?

Chrisjigsaw
Shopify Partner
50 1 46

 

Hey all-

 

There have been MANY times (two separate occasions just today!) where I've needed to know which products a particular customer has purchased, but can't for the life of me figure out how to quickly find this info without exporting that customer's orders to a csv file and then opening it in Excel to sort through there. There's gotta be an easier way to view all products sold to a customer, right? And when I say that, I don't mean simply seeing if someone has bought a certain item or not; no, I need to see a full list of every product they've ever purchased in one place. Can anyone help me with a way to do this? Assistance with the logic for a GraphiQL query would super-appreciated, as the documentation I've found for that hasn't provided me with enough clues to get started.  Thanks!

 

Man, it's times like this when I really miss php/mysql... 😛

 

Chris

 

P.S. PLEASE do not try to sell me another damn app! That is just not helpful - thanks.

shop owner / web developer / Shopify supporter (and critic) since 2015
Replies 7 (7)

CloudlabSam
Shopify Partner
590 47 103

You can use the Sales by Customer Name report and filter by a specific customer.

Chrisjigsaw
Shopify Partner
50 1 46

Thanks - that sounds perfect! But where would I find that? When I look in the reports section, there are only about 25 reports to look at...  😕

shop owner / web developer / Shopify supporter (and critic) since 2015
CloudlabSam
Shopify Partner
590 47 103

Which version of Shopify do you have?

Chrisjigsaw
Shopify Partner
50 1 46

Ah, I see - I'm on the Basic plan, albeit an older version I was grandfathered into...  I guess that means I gotta pay to see what's going on then?  😕

 

Chris

shop owner / web developer / Shopify supporter (and critic) since 2015
CloudlabSam
Shopify Partner
590 47 103

Yeah that report won’t exist on Basic. You can use the Admin API yourself to filter down to the orders you want. 

Or I could recommend an app for you 🙂

Chrisjigsaw
Shopify Partner
50 1 46

Well, that's actually what my first question was above. 😉

 


Can anyone help me with a way to do this? Assistance with the logic for a GraphiQL query would super-appreciated, as the documentation I've found for that hasn't provided me with enough clues to get started.

Thanks!

 

Chris

shop owner / web developer / Shopify supporter (and critic) since 2015
CloudlabSam
Shopify Partner
590 47 103

Understood. The thing is there's not an easy way. You can use the Orders query to get all orders for the time period you are interested in. Then you have to cursor through them and look at each order to determine if it's for the customer you want. If an order matches, then you would look at all of the line items on that order to get the products purchased.

 

There are apps that will let you do this for free in 1-2 minutes.