Categories order in REST API endpoint
-
Dear All!
My problem is exactly what @mic365 had in this topic:
https://wordpress.org/support/topic/categories-ordering-not-working-on-rest-api-on-3-6-2/The order for the categories for the wp-json/wc/v2/products/categories endpoint is not returning the categories in the order, which we saved on backend and which they are display on the site.
@mic365 answered 11 months ago:
“We ended up hooking woocommerce_rest_product_cat_query and setting $prepared_args[‘menu_order’] = 1;, since you can not pass this parameter on the url.
From my point of view it’s a bug on wc_change_get_terms_defaults — I’d expect the default sort not to be by name if the categories were manually ordered on the backend.”
I tried to search for this on the web, but didn’t found any example how to do that 🙁
I never wrote a hook for Woocommerce, so I would like to ask for help, how to accomplish this hook @mic365 was mentioning?Thank you very much!
The topic ‘Categories order in REST API endpoint’ is closed to new replies.