Getting all orders of a customer with API

QualityUnit_s_r
Shopify Partner
14 0 2

Getting all orders of a customer with API is pretty staight forward way of API use. And it's a pretty common case, right? To know which orders belong to a customer, when having thousands of existing orders, is very useful.

I do not know why this is not supported by API. I did not find a way how to filer orders by email address, even the solution this forum offers does not work.

What I am trying to do is to use admin/orders.json with a filter for email (or customer ID if there is a way). Could anybody help me with this? Or could Shopify developers add this obvious filter?

Thank you very much.

Jason
Shopify Expert
10277 144 1945

Hey QualityUnit,

You can get orders attached to a customer via their ID.

GET /admin/orders.json?customer_id=207119551

As per notes in the docs:
https://help.shopify.com/api/reference/customer#orders

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
QualityUnit_s_r
Shopify Partner
14 0 2

Cool! I must have overlooked it as I focused on Orders.

Thank you.

0 Likes
Jayvin
Shopify Partner
167 25 35

To get all customer orders: you have to add order "status" as well else you will get only "open" orders.

So endpoint can be something like this: 

/admin/customers/#{id}/orders.json?limit=#{limitNumber}&page=#{pageNumber}&status=any

 

phpwebindia
New Member
1 0 0

What about retrieve orders by email-id and phone number. If customer on call support, support agent have easy access of Phone and Email-id then customer ID. So please give option to fetch orders by customer register email id & phone number.

0 Likes