Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update properties on a shopify line_item

Tags:

api

shopify

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"}]}]}}
like image 274
MTilsted Avatar asked Apr 01 '16 08:04

MTilsted


People also ask

How do I change line item properties in Shopify?

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.

What is line item properties in Shopify?

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.


1 Answers

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.

like image 138
Ben Dunlap Avatar answered Sep 21 '22 15:09

Ben Dunlap