Hi All,
I have followed the guide https://shopify.dev/tutorials/edit-an-existing-order-with-admin-api & https://shopify.dev/docs/admin-api/graphql/reference/orders/ordereditaddlineitemdiscount
to edit and order by adding an discounted variant.
body: JSON.stringify({
query: mutation orderEditAddLineItemDiscount($input: ID!, $lineItemId: ID!, $discount: OrderEditAppliedDiscountInput!) { orderEditAddLineItemDiscount(id: $input, lineItemId: $lineItemId, discount: $discount){ addedDiscountStagedChange { id } calculatedLineItem { id } calculatedOrder { id } userErrors { field message } } },
variables: { “input”: “gid://shopify/CalculatedOrder/”+calculatedOrdrID,
“lineItemId”: “gid://shopify/ProductVariant/”+calculatedLineItem,
discount: {percentValue: 100, description: “freee”}
}
})
Am getting error as {“errors”:[{“message”:“Field ‘orderEditAddLineItemDiscount’ doesn’t exist on type ‘Mutation’”,“locations”:[{“line”:2,“column”:7}],“path”:[“mutation addDiscount”,“orderEditAddLineItemDiscount”],“extensions”:{“code”:“undefinedField”,“typeName”:“Mutation”,“fieldName”:“orderEditAddLineItemDiscount”}},{“message”:“Variable $input is declared by addDiscount but not used”,“locations”:[{“line”:1,“column”:1}],“path”:[“mutation addDiscount”],“extensions”:{“code”:“variableNotUsed”,“variableName”:“input”}},{“message”:“Variable $lineItemId is declared by addDiscount but not used”,“locations”:[{“line”:1,“column”:1}],“path”:[“mutation addDiscount”],“extensions”:{“code”:“variableNotUsed”,“variableName”:“lineItemId”}},{“message”:“Variable $discount is declared by addDiscount but not used”,“locations”:[{“line”:1,“column”:1}],“path”:[“mutation addDiscount”],“extensions”:{“code”:“variableNotUsed”,“variableName”:“discount”}}]}
The fieldname is given as per document only. But it says it doesn’t exist on type “Mutation”.Can anyone help me on this.



