acf-to-rest-api icon indicating copy to clipboard operation
acf-to-rest-api copied to clipboard

WooCommerce "product_cat" taxonomy is not working

Open jancikviktor opened this issue 4 years ago • 5 comments

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.

jancikviktor avatar Oct 23 '20 14:10 jancikviktor

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 ?

mhadaily avatar Oct 29 '20 01:10 mhadaily

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.

jancikviktor avatar Oct 29 '20 15:10 jancikviktor

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 avatar Jan 08 '21 02:01 chanceproth

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.

chanceproth avatar Jan 08 '21 18:01 chanceproth

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

Astraport avatar Jan 09 '21 14:01 Astraport