Is it possible to remove one LineItem from Order via GraphQL or REST?
I need to remove LineItem from order, in documentation says that it is possible but there are no API to remove LineItem!!
If someone has done this before, can help me with this issue? Or may be Shopify Support can tell me how can I do it?
To follow instructions on this page you will require basic understanding of Graphiql, and it will be easier to test it by using the Graphiql app by shopify. Please install this app in your store and ensure that required permission(write_order_edits) are selected while you install.
To remove the line item I have followed following steps:
orderEditBegin
mutation orderEditBegin($id: ID!) {
orderEditBegin(id: $id) {
userErrors {
field
message
}
calculatedOrder {
id
lineItems(first: 5){
edges{
node{
id
quantity
}
}
}
originalOrder{
lineItems(first:5){
edges{
node{
id
}
}
}
}
}
}
}
provide this as query variable. replace <<order_id>> with your order id. you can find this id in the address bar of your browser when you open the order from admin.
{
"id": "gid://shopify/Order/<
2. changeLineItemQuantity
replace <<calculated_order_id>> and <<calculated_lineitem_id>> in the following code. you should have received these in the response of step 1 mutation. Notice that I have specify quantity: 0 to remove the line item
```javascript
mutation changeLineItemQuantity {
orderEditSetQuantity(id: "gid://shopify/CalculatedOrder/<
3. commitEdit
replace the <<calculated_order_id>> in the following code snipped
```javascript
mutation commitEdit {
orderEditCommit(id: "gid://shopify/CalculatedOrder/<
after this step you will be able to check these changes in the Admin
@Dmitriy_97@crpatel@Brian_S_1 Did you actually find the solution for this. We are unable to do so by following this Remove line items (API) from this for the orders that are fulfilled, returned and the order that has duties and taxes applied. It will be of great help.