How do I update the properties for a specific line_item using the shopify api?
There does not seem to be a method to directly update a specific line item.
I then tried to update the entire order object instead, but it seems like it is not saving my properties. If I save the order with the following json, the api returns the full order object, but with an empty properties [] line for my line_items.
{"order":{"id":94202342,"line_items":[{"id":615546756,"variant_id":627937216,"properties":[{"my_test_key":"This_is_a_test"}]}]}}
Per Corey's comment, the safest thing to do when updating a line item's properties is to get the existing properties for the line, update the value(s) that need updating, then hit the /cart/change. js endpoint with the updated object.
Line item properties are used to collect customization information for an item added to the cart. This information can be collected from the buyer on the product page.
You can create a new order with the API but you can't update the line items of an existing order.
From the Order API docs:
You should also note that you can change only a few of an order's attributes using the API. You cannot change the items or the quantities in an order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With