WooCommerce REST API自定义字段 [英] WooCommerce REST API Custom Fields

查看:116
本文介绍了WooCommerce REST API自定义字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过WooCommerce REST API访问订单,产品,客户的自定义字段?如果不是本地的,那么哪些插件,解决方法或黑客工具可以正常工作呢?谢谢!

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 work? Thanks!

推荐答案

回答我自己的问题:

可以使用以下命令:(使用v3旧版API)

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

这也适用于产品.

这篇关于WooCommerce REST API自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆