Support

Account

Home Forums ACF PRO Update WooCommerce product category custom fields using REST API

Helping

Update WooCommerce product category custom fields using REST API

    • pablito

    • March 23, 2020 at 9:58 pm

    I have no problem updating the custom fields of wocommerce products. The response json also returns all the acf fields of the product.

    The problem is when I try to update the custom fields of the woocommerce product categories with REST API.
    The response json does not return the acf fields of the category as it happens for the products .. why? … WordPress gives me the following error:
    {“code”: “cant_update_item”, “message”: “Cannot update item”, “data”: {“status”: 500}}

    I added these custom fields to the woocommerce categories: title_01 and text_01

    This is the url I call from my script to update with the REST API:
    https://mysite.com/wp-json/acf/v3/categories/MYCATID
    … the end point is correct one to modify che custom fields?

    I send these parameters in the call:
    {“fields”: {“title_01”: “My title”, “text_01”: “My text”}}

    can someone help me?

    • pablito

    • March 23, 2020 at 11:00 pm

    it seems that this end point is not editable:
    /wp-json/acf/v3/{taxonomy}/{id}

    The end point I tried to use is:
    https://mysite.com/wp-json/acf/v3/categories/123
    (Is there a specific end-point for woocommerce categories for example like: https://mysite.com/wp-json/acf/v3/product/categories/123 ???)

    If I make a GET call of the url (https://mysite.com/wp-json/acf/v3/categories/123), the response is:
    {“acf”:{“title_01″:”My title”,”text_01″:”My text”,}}

    With POST or PUT call the response is:
    {“code”:”cant_update_item”,”message”:”Cannot update item”,”data”:{“status”:500}}

    My WP version is: 5.3.2
    My Advanced Custom Fields PRO version is 5.8.8

    Please help…..

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.