如何使用woocommerce rest api向客户添加元数据?

时间:2018-09-11 14:35:14

标签: wordpress woocommerce

我需要使用woocommerce rest api将元数据(CNPJ)添加到客户资料中; 我正在从离子应用程序发送此数据:

  {
  "customer": {
    "billing_address": {
      "company": "Company Name ABC",
      "address_1": "St. ABC ",
      "address_2": "121",
      "state": "NY",
      "city": "New York",
      "postcode": "99000-000",
      "phone": "345456456",
      "country": "US",
      "email": "email@gmail.com",
      "first_name": "Bob",
      "last_name": "Doe"
    },
    "shipping_address": {
      "first_name": "Bob",
      "last_name": "Doe"
      "company": "Company Name ABC",
      "address_1": "St. ABC ",
      "address_2": "121",
      "state": "NY",
      "city": "New York",
      "postcode": "99000-000",
      "country": "US"
    },
    "meta_data": [
      {
        "key": "cnpj",
        "value": "123123123123123"
      }
    ],
    "first_name": "Bob",
      "last_name": "Doe"
    "email": "email@gmail.com",
    "password": "123456",
    "username": "bobdoe"
  }
}

客户已成功注册,但元数据未成功注册。 ionic应用程序正在使用/ wc-api / v3 / customers端点。

怎么了?是否可以使用woocommerce REST API将元数据保存到客户资料中?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,我可以使用以下解释来解决:https://github.com/claudiosanches/woocommerce-extra-checkout-fields-for-brazil/issues/56

注意:我正在wordpress中使用此插件woocommerce-extra-checkout-fields-for巴西来获取其他字段。