Hello,
We are looking at the newer Edit Order feature using GraphQL on the 2020-01 API version.
Regarding starting the process to edit an order, it is my understanding that we need to start a mutation of orderEditBegin and pass in the Shopify Order Id to get the Calculated Order Id. To be clear, this is currently working as expected and I’m able to get the Calculated Order Id back to make the next call of actually editing the order.
Here is the code that I’m running to get the calculated order id.
client = ShopifyAPI::GraphQL.client
QUERY = client.parse <<-GRAPHQL
mutation {
orderEditBegin(id: "gid://shopify/Order/2140232974441") {
calculatedOrder {
id
}
}
}
GRAPHQL
result = client.query(QUERY)
From here I’m just looking to simply test changing the line item quantity of an item on the returned order. At this point, I’m not sure how to get back the Calculated Line Item Id on an order and I’m not seeing any documentation on if another call is needed to get this or what the best way of getting the Calculated Line Item Id’s would be?
I’m looking to run something like this.
QUERY = client.parse <<-GRAPHQL
mutation {
orderEditSetQuantity(id: "gid://shopify/CalculatedOrder/529268841", lineItemId: "gid://shopify/CalculatedLineItem/4645169856617", quantity: 2) {
calculatedOrder {
id
addedLineItems(first: 5) {
edges {
node {
id
quantity
}
}
}
}
userErrors {
field
message
}
}
}
GRAPHQL
result = client.query(QUERY)
To sum up my question, What is the best way to get the calculated id’s for both the order and it’s line items?
Thank you
William