Perhaps far too broad a question for the forums, but I’ve just completed some work on an automation that edits Shopify orders to add a free gift post sale, and I’m a bit confused.
First off, the REST API doesn’t have a facility to edit orders as far as I can tell, at least not in a meaningful way where you can change line items. You can update tags, change statuses, but not much else. The GraphQL API, however, does (why can’t the REST API do this?)
Following the example guide for editing a product, I ended up having to create 4 sequential tasks just to add a single line item to an order. You have to initialise the order for editing, then add a line item, then add a discount to that line item, and finally commit the changes. Why can’t I do this in a single POST request, or less of them at least? Why can’tI add a line item with a discount at the same time?
I’m very new to GraphQL so I presume there must be a benefit to this stateful behaviour, and also a reason why the more simplistic REST API doesn’t allow you to edit orders. Perhaps I’m simply using it wrong, but the system I was using (Zapier) treated each part of the process as a web request (and billed me accordingly)
Interested to hear thoughts.
Thanks in advance.