how to add metadata to customer using woocommerce rest api?

Viewed 1810

I need to add a metadata (CNPJ) to the customer profile using woocommerce rest api; I'm sending this data from the ionic app:

  {
  "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"
  }
}

The customer is registered successfully, but the metadata doesn't. The ionic app is using the /wc-api/v3/customers endpoint.

What's wrong? Is it possible to save metadata to customer profile using the woocommerce REST API?

1 Answers
Related