WooCommerce REST API Custom Fields

后端 未结 2 1886
轮回少年
轮回少年 2021-02-08 04:54

Is it possible to access custom fields for orders, products, customers via WooCommerce REST API? If not natively, then what plugins or workarounds or hacks are out there that wo

2条回答
  •  被撕碎了的回忆
    2021-02-08 05:35

    Answering my own question:

    It is possible using the following: (using v3 legacy API)

    To send custom fields back to the server: (For Orders)

    {
      "order_meta": {
         "key": "value"
      }
    }
    

    To retrieve custom fields from server use this filter with your end point:

    http://www.example.com/wc-api/v3/orders?filter[meta]=true
    

    This works for Products as well.

提交回复
热议问题