Updating Product Custom Fields using the REST API won't work

Support MB REST API Updating Product Custom Fields using the REST API won't workResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37187
    gdeweygdewey
    Participant

    Hello,
    I'm trying to update two custom fields on my woocommerce products doing the following:

    curl --location -g --request POST 'https://my.site/wp-json/wc/v3/products/317?meta_box={"inventory_warehouse1":1}' \ 
    --header 'Authorization: XXXXX'
    curl --location --request PUT 'https://my.site/wp-json/wc/v3/products/317' \
    --header 'Authorization: XXXXXX' \
    --header 'Content-Type: application/json' \
    --data-raw '{"meta_box": {"inventory_warehouse1":1 } }'

    But no success. Any idea what could be the issue?

    #37205
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If the custom fields are created by Meta Box, please use the Rest API v2 to update the field value. Please read more on the documentation https://docs.metabox.io/extensions/mb-rest-api/

    The Rest API v3 is used to update the fields of WooCommerce version 3.5 or later. Please read more here https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction

    #37221
    gdeweygdewey
    Participant

    The issue was that I was using the woocommerce API instead of wordpress. Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.