customer.orders not returning all orders.

New Member
6 0 0

Hey all,

I've been trying to retrieve all the orders a customer has placed with my shop, but when I call customer.orders, it only returns 20 orders (the customer has place 43 orders). The shopify API documentation doesn't describe any limits on this call. Has anyone experienced this issue before? Anyone with any ideas on how to resolve?

Thanks!

0 Likes
Highlighted
Shopify Partner
221 0 13

Hey Mahmoud, 

All API calls have a limit of 25 to 50 lines by default usually. But you can set them up to a max of 250 lines per call. Just add the property "limit=250" and youll get a max of 250 lines.

Aditionally if you are going to get more then 250 you can use a "/count.json" endpoint to see how many orders, products or customers you are bringing with you query and do a loop accordingly to bring all the lines for that query.

I hope I explained myself here haha, if you have any questions, do ask :D Good luck!

Cheers!

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! :P

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com :D
1 Like
New Member
6 0 0

Hey Jurgen,

Thanks for taking the time to reply! So how would I add this argument? Would I have to make an ajax call as opposed to using the liquid global object? Or is there some kind of configuration I can change in one of the json files?

0 Likes
Shopify Partner
221 0 13

Hey Mahmoud, 

So you are talking about liquid code? if so it would be something like: 

{% for order in customer.orders by 250(250 is max) %}
code
{% endfor %}

in liquid code you can add the by to increase the limit of orders for each pagination, If Im not mistaken the max is 250. Hope this helps. 

You can see more here: https://help.shopify.com/en/themes/liquid/tags/theme-tags#paginate Its a pagination on products, but should work the same for orders.

Cheers!

 

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! :P

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com :D
1 Like
New Member
6 0 0

Thanks for all your help!

0 Likes