Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future<List<WooProductCategory>> getProductCategories #61

Closed
CodesbyRobot opened this issue May 27, 2021 · 4 comments
Closed

Future<List<WooProductCategory>> getProductCategories #61

CodesbyRobot opened this issue May 27, 2021 · 4 comments

Comments

@CodesbyRobot
Copy link

Exception has occurred.
_Exception (Exception: WooCommerce Error!
code: rest_invalid_param

calling woocommerce.getProductCategories(orderby: "") throws the exception above with the message:
Orderby isn't a valid parameter.

@iNahvi
Copy link

iNahvi commented Jul 19, 2021

The Problem is

woocommerce.getProductCategories(orderby: "")

you are passing an empty value there.

orderby - string
Sort collection by resource attribute.
Options: 
id, include, name, slug, term_group, description and count. Default is name.

https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#list-all-product-categories

@CodesbyRobot
Copy link
Author

It is just to show which part was giving errors, i put the values inside but the error isn't about them.

@iNahvi
Copy link

iNahvi commented Jul 21, 2021

I tested all the options for orderBy by itself alone and along with order (asc | desc)

await wooCommerce.getProductCategories(order: 'asc', orderBy: "id");

the only time it had thrown this woocommerce error below as the one u also have shown

Exception has occurred.
_Exception (Exception: WooCommerce Error!
code: rest_invalid_param
message: Invalid parameter(s): orderby
status: 400)

is when the orderBy value is any other than the provided options in the Woocommerce Rest Api.
(id, include, name, slug, term_group, description , count).

So if the error is not otherwise, please do provide some more details.
maybe in another parameter like include or exclude??

exclude array Ensure result set excludes specific ids.
include array Limit result set to specific ids.

@CodesbyRobot
Copy link
Author

You are right, it works. Strange Anyway 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants