Remove line item from order by API

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 :waving_hand:

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!

@ShopifyDevSup
I have tried this method but where i got CalculatedLineItem is it from after place order

Hi @vinodk ,
I find a useful article: https://community.shopify.com/c/customers-discounts-and-orders/remove-lineitem-form-order-via-api-rest-graphql/td-p/1338407