Modifying custom attributes for Shopify order line items

I’m trying to modify custom attributes for specific line items in Shopify orders using their API. I can’t find a direct endpoint to update individual line items. When I try updating the whole order instead, my custom attributes don’t get saved properly. Here’s what I’m sending:

{
  "order": {
    "id": 78451923,
    "line_items": [
      {
        "id": 892345167,
        "variant_id": 445782391,
        "properties": [
          {"custom_field": "sample_value"}
        ]
      }
    ]
  }
}

The API responds with the complete order data but the properties array comes back empty. Has anyone successfully updated line item custom fields through the order update endpoint?

The order update endpoint is tricky when it comes to line item properties. You must include all existing line items in your update request, even the ones you are not modifying. Shopify’s API does not support partial updates effectively, which can lead to issues if you attempt to update just one line item. Additionally, ensure that you are using the PUT method and that the entire line item object is included—this means quantity, price, and other relevant details must be present. Omitting any required fields can result in silent validation failures of the properties. Lastly, be cautious with the naming of your custom fields; using names that collide with Shopify’s reserved property names can result in those properties being stripped from the request.

yeah, i ran into the same issue. make sure you update with the right prop format: "properties": [{"name": "custom_field", "value": "sample_value"}]. it needs name/value pairs, not just key/value objects.

Had this exact problem last month - drove me crazy for hours. You’re probably missing the complete line item structure in your update. Shopify needs the full line item object when you modify properties - quantity, title, price, everything. Not just the properties you want to change. I made the same mistake, only sending the properties array. Also check you’re using the right order update endpoint with PUT method. One more thing - if the order’s been fulfilled or partially fulfilled, some properties become read-only and won’t update no matter what you send. Test with a draft order first to see if it’s your payload or the order status blocking it.