vinodk
December 20, 2022, 10:16am
1
I want to remove line item from order and add new variant in the order when order is placed. but there is no api for deleting line item from order
I have tried with below article
https://shopify.dev/apps/fulfillment/order-management-apps/order-editing#add-a-new-variant
Hi [email removed]vinodk
To remove an item from an order, you can use the orderEditSetQuantity
mutation and modify the line item quantity to zero. It’ll look something like the below:
mutation ($id: ID!, $lineItemId: ID!, $q: Int!) {
orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $q) {
calculatedOrder {
id
lineItems (first:10){
nodes {
id
quantity
editableQuantity
editableQuantityBeforeChanges
}
}
}
}
}
With variables:
{
"id": "gid://shopify/CalculatedOrder/28359622774",
"lineItemId":"gid://shopify/CalculatedLineItem/11789885210742",
"q": 0
}
Hope that helps!
vinodk
December 22, 2022, 6:26pm
3
@ShopifyDevSup
I have tried this method but where i got CalculatedLineItem is it from after place order