I need to find a way to cut down return time for queries. I am using zapier to run scripts for updating orders and have ran into some calls taking a long time. It seems that the begin edit and commit can take longer than other queries (I have not done any actual testing on turnaround time). My queries are as follows:
mutation beginEdit{
orderEditBegin(id: “gid://shopify/Order/%s”){
calculatedOrder{
id
lineItems (first: 20) {
edges {
node {
id
editableQuantity
title
variant{
title
legacyResourceId
}
}
}
}
}
}
}
mutation commitEdit {
orderEditCommit(id: “gid://shopify/CalculatedOrder/%s”, notifyCustomer: false, staffNote: “Updated order”) {
userErrors {
field
message
}
}
}
Is there a clean way of knowing how many line items I should request for the calculated order in begin edit? Is there a way to request only the line items with editable quantity greater than 0? (I do not want to see removed items). Ive tried to apply the query filter: " lineItems (first: 20, query: “editable: True”){", but get this message:
{‘errors’: [{‘message’: ‘Internal error. Looks like something went wrong on our end.\nRequest ID: a27d6b89-3435-4690-a306-2fe8a3453c8e (include this in support requests).’, ‘extensions’: {‘code’: ‘INTERNAL_SERVER_ERROR’, ‘requestId’: ‘a27d6b89-3435-4690-a306-2fe8a3453c8e’}}]}
For the commit order, is there a way to speed up the turnaround time?
This script may have to run multiple times on a single order (as data from customers comes in overtime, could even be days apart), so it’s important that I get all the current items so that we can figure out if the appropriate items are added and if the correct quantities are present.
As a side note: My script actually makes two calls: 1) begin edit (get the calculated order with current items) 2) update order (can add multiple items or edit multiple quantities, using aliases on any repeating queries)