woocommerce / woocommerce-rest-api

This is the WooCommerce core REST API Package. It runs standalone as a feature plugin too.
71 stars 46 forks source link

Get products with sorted categories - Woocommerce API #258

Open probance-antoine opened 3 years ago

probance-antoine commented 3 years ago

Hello,

I have a problem with the woocommerce API. When I list a product I would like to have the categories in order (main category, sub category, sub sub category) :

On the production site of one of my customers the result is a bit random… If I list a product with 2 categories with IDs less than 200 the result is OK If I list a product with 2 categories, the first one < 200, the second one > 200 OK on my test site, KO on the customer site (sub category –> Main category) If I list a product with 3 categories, the first < 200, the second < 200, the third > 200, OK on my test site, KO on the client site (sub sub category –> Main category –> Sub category) Here is a link where you can see the problem :

https://www.loom.com/share/06d242a665c04d6084bbfdac81bf0830

We tried by disabling all plugins (except the woocommerce one of course), unfortunately it doesn’t change anything. Is there a parameter that could influence the sorting of categories ? The categories are well sorted in the “category” tab of the woocommerce interface (as you can see on the loom video).