You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to update the line item quantity on an order in Shopify using GraphQL and I am getting "invalid id" error. Can you please help figure out what the issue is? I verified the order and line item id exists in Shopify.
This is my code:
var graphRequest = new GraphRequest()
{
query = """
mutation orderEditSetQuantity($id: ID!, $lineItemId: ID!, $quantity: Int!) {
orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $quantity) {
calculatedLineItem {
id
quantity
}
calculatedOrder {
id
}
userErrors {
field
message
}
}
}
""",
variables = new
{
id = $"gid://shopify/Order/{orderID}",
lineItemId = $"gid://shopify/LineItem/{lineItemID}",
quantity = 0
}
};
var service = new GraphService(Url, Token);
var resultType = typeof(ShopifySharp.GraphQL.OrderEditSetQuantityPayload);
var result = await service.PostAsync(graphRequest, resultType);
The text was updated successfully, but these errors were encountered:
Hey @saeedasma! Thanks for reaching out about this. Your GraphQL IDs look correct to me based off of this reference provided by Shopify. I think the problem might be because you're using the deprecated variables property on GraphRequest instead of the recommended Variables which replaced it. The way variables (old one) gets serialized is slightly different, so that may be where things are going awry.
Hello,
I am trying to update the line item quantity on an order in Shopify using GraphQL and I am getting "invalid id" error. Can you please help figure out what the issue is? I verified the order and line item id exists in Shopify.
This is my code:
var graphRequest = new GraphRequest()
{
query = """
mutation orderEditSetQuantity($id: ID!, $lineItemId: ID!, $quantity: Int!) {
orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $quantity) {
calculatedLineItem {
id
quantity
}
calculatedOrder {
id
}
userErrors {
field
message
}
}
}
""",
variables = new
{
id = $"gid://shopify/Order/{orderID}",
lineItemId = $"gid://shopify/LineItem/{lineItemID}",
quantity = 0
}
};
var service = new GraphService(Url, Token);
var resultType = typeof(ShopifySharp.GraphQL.OrderEditSetQuantityPayload);
var result = await service.PostAsync(graphRequest, resultType);
The text was updated successfully, but these errors were encountered: