Product API sorting

Mahendra
Shopify Partner
1 0 0

Hi,

I need all the products sorted on updated_at field. How can I achieve this?

When I call https://ivend365demo.myshopify.com/admin/products.json?order=updated_at I get the following error...

{
    "errors": {
        "Attempt to order records by unknown orders updated_at, expected [:total, :title, :created_at, :updated_at]": "Required parameter missing or invalid"
    }
}

 

Please help.

Regards,

Mahendra

 

 

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 293

The order filter parameter is not documented on products and therefore not supported. At this time it simply does not appear to work. You'll need to apply sorting on your end.

0 Likes
herquiloide
New Member
3 0 0

If you are working with NodeJs, you could use the Shopify Api Node Library there is a method to sort products in a collection:

 

shopify.smartCollection.order(collection.id, {products: your_sorted_ids_of_products});

 

 

Note: The sort_order of your collections must be set to Manual in order to work.

 

0 Likes