airesvsg / acf-to-rest-api

Exposes Advanced Custom Fields Endpoints in the WordPress REST API
https://wordpress.org/plugins/acf-to-rest-api/
1.33k stars 110 forks source link

WooCommerce "product_cat" taxonomy is not working #356

Open jancikviktor opened 3 years ago

jancikviktor commented 3 years ago

Hello, I am trying to GET (and after that I need to use POST) for Product categories based on WooCommerce.

I'm trying for products, it works fine, I got this after getting output;

{ "id": 31876, "acf": { "supplier": "wt", "tax_val_wt": "20", "cost_base_wt": "100", "cost_tax_wt": "120", "stock_qty_wt": "2.5", "ext": "test" } }

but for product_cat I get; every time

{ "code": "rest_no_route", "message": "Not found", "data": { "status": 404 } }

Is it possible to get product categories? Because I found out in sepcs that it should be working with; /wp-json/acf/v3/{taxonomy}/product_cat

Thank you, Victor.

mhadaily commented 3 years ago

Hi, I have faced the exact same issue today, just wondering if you already have a solution if not, how and where can we start investigating to see if we can add this to this amazing plugin ?

jancikviktor commented 3 years ago

No, I didn't resolve it yet. We already decided to use directly post_meta in MySQL DB to insert these parameters, it seems that it is a better way, we're finishing it now.

chanceproth commented 3 years ago

I am also stumped on something similar, but I think I might have more information...

It seems you can do... xx.com/wp-json/acf/v3/product xx.com/wp-json/acf/v3/product/XXX xx.com/wp-json/acf/v3/categories/XXX

But for me getting the whole category list does not work... xx.com/wp-json/acf/v3/categories

I get an empty array, so it seems like it wants to be a valid endpoint.

Any relevant advice would be helpful.

chanceproth commented 3 years ago

After more investigation, it looks like the call to... xx.com/wp-json/acf/v3/categories

Only returns post categories with ACF and does not include any product categories.

But calls to... xx.com/wp-json/acf/v3/categories/[Post-or-Product_cat_id] works as expected and returns a post cat with ACF or a product_car with ACF.

Would love to find an endpoint or solution to this. Seems like it's very close.

Astraport commented 3 years ago

POST acf data via /wp-json/acf/v3/categories/ not working.