Error 22 order_add_line_items

Here is the Mutation that I am struggling with:

mutation {
order_add_line_items(data: {
order_id: "T3JkZXI6MTczMzk0NzI4"
line_items: [
{
sku: "LB-COFFEE-PREM-GROUND-MED"
partner_line_item_id: "6090483728444-173393752-1"
quantity: 1
  price: "34.95"
}
]
}
) {
  request_id
order{id
}
}
}

Here is the reponse:

{
  "errors": [
    {
      "message": "Unexpected Error",
      "operation": "order_add_line_items",
      "field": "order_add_line_items",
      "request_id": "601d90705ecc03152a2eac20",
      "code": 22
    }
  ],
  "data": {
    "order_add_line_items": null
  }
}

Hi @Mike!
Are you trying to add a new item?
In that case, try by sending a different partner_line_item_id because that one already exists on the order.

You can see that if you do the following Query:

query {
  order(id: "173393752") {
    request_id
    complexity
    data {
      line_items(first: 5) {
        edges {
          node {
            partner_line_item_id
          }
        }
      }
    }
  }
}

The Partner Line Item IDs need to be unique.

I will make a request for this error to be returned in a friendlier way.

Please let me know if I might have that wrong or if there is anything else I could help with.

Thanks in advance!
Tom

Hi @tomasw , can you please check request id: 602425a7a156719a98acefe0
I’m getting the unexpected error with order add_line_items mutation.

Hi @devrsingh2!
Thanks for the request_id!

Try by not sending the partner_line_item_id or using a different value, because that one already exists.
If you need to update the quantity for an existing SKU on the order try using order_update_line_items

Let me know if that doesn’t help or I could provide a more concrete example.
Thanks again!
Tom

Thanks @tomasw ,

I have solved that problem

1 Like