Support » Plugin: WooCommerce » meta_data on order creation (Rest API)

  • Resolved mlittle408


    I am working with the rest api (v3) and ionic. I am trying to create an order (which works fine) but along with that order I am trying to add meta_data. I can see the meta_data in rest with orders that have been submitted though wordpress. When I submit the order I am getting the following error:

    data: {status: 400, params: {meta_data: “meta_data is not of type array.”}}
    message: “Invalid parameter(s): meta_data”

    Here is a code snippet:

    data = {
    payment_details : {
    method_id: paymentData.method_id,
    method_title: paymentData.method_title,
    paid: true
    billing: this.newOrder.billing,
    shipping: this.newOrder.shipping,
    line_items: orderItems,
    meta_data: {
    “vets_name”: this.newOrder.meta_data.vets_name,
    “vets_city”: this.newOrder.meta_data.vets_city,
    “vets_state”: this.newOrder.meta_data.vets_state,
    “vets_phone”: this.newOrder.meta_data.vets_phone,

    Without the meta_data, the order is created without a problem.


Viewing 1 replies (of 1 total)
  • mlittle408


    I solved this by testing it with Insomnia. Awesome tool. Here’s the way it should have been written:

    meta_data: [

Viewing 1 replies (of 1 total)
  • The topic ‘meta_data on order creation (Rest API)’ is closed to new replies.