Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching all of a single customer’s orders on Shopify

Is there a way to get at all of a customer's orders on Shopify? For example:

o = ShopifyAPI::Customer.find(…).orders
like image 835
Edward Ocampo-Gooding Avatar asked Jan 18 '26 01:01

Edward Ocampo-Gooding


1 Answers

At the moment there isn't a way to filter orders by customer through that endpoint.

You will need to get all orders and filter them by their contents, which includes the customer id.

orders.select{ |o| o.customer.id == customer_id }

If this needs to be done quickly, then you may need to store the orders in your database, and keep them in sync with webhooks. There is a Syncing with a Store page on the Shopify Wiki that explains how to do this.

like image 100
Dylan Smith Avatar answered Jan 20 '26 13:01

Dylan Smith