Order by not working with Draft Order api

Highlighted
Shopify Partner
15 0 4

Hi Guys,

There seems to be a bug in case of sorting order_by in Draft order APIs.

I have tried to access the order API with the following URL and it is working perfectly:

https://cueblocks-2.myshopify.com/admin/orders.json?limit=10&fields=name,status&order=created_at%20d...

But when I try to access with the same parameters with the draft order API, it only shows the result in ascending order.

https://cueblocks-2.myshopify.com/admin/draft_orders.json?limit=10&fields=name,status&order=created_...

Does anyone face the same issue with Draft Order API?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1555 81 282

Hey Akki,

As an undocumented filtration method on both (from what I can tell) the order and draft order endpoints, it's not going to be guaranteed to work.

If you're filtering by created_at, I would suggest instead using since_id. Not only will it accomplish effectively what you want to achieve, but it will also be more performant.

Cheers.

1 Like
Highlighted
Shopify Partner
15 0 4

Hi Alex,

Thank you for the quick response.

As far as I know the since_id parameter will also result me the draft orders in ascending order but my requirement is to dislpay latest order first. You have any work around here?

Cheers,

AK

0 Likes
Highlighted
Tourist
5 0 0

Have you found a solution?


@Akki wrote:

Hi Alex,

Thank you for the quick response.

As far as I know the since_id parameter will also result me the draft orders in ascending order but my requirement is to dislpay latest order first. You have any work around here?

Cheers,

AK


 

0 Likes
Highlighted
Shopify Partner
26 0 1

This would be really useful - that along with the same abilities to search for draft orders by customer, company, tag, or keyword.

0 Likes