I have tried to get list of top sales product by Woocommerce API, I'm using version 1 of WooCommerce API. I tried this following endpont, but it does not work:
My Request:
https://DOMAINNAME.com/wp-json/wc/v1/products?consumer_key=CONSUMER_KEY&consumer_secret=CONSUMER_SECRET&category=CATEGORY_ID&order=asc&orderby=total_sales
But it Responses:
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): orderby",
"data": {
"status": 400,
"params": {
"orderby": "orderby is not one of date, id, include, title, slug."
}
}
}
orderby is not one of date, id, include, title, slug.
So, I can order by date, ID, include, title and slug only. How can I order by total_sales
. Is it possible to do? Or can you suggest any other way?