No able to get calculatedLineItem of specific item in order to update order.

No able to get calculatedLineItem of specific item in order to update order.

vikasranjan
Shopify Partner
12 0 1

Hi I am trying to update an item in the order. So I am using this mutation

 

mutation ($id: ID!) {
                orderEditBegin(id: $id){
                    calculatedOrder{
                        id
                        lineItems(first:10) {
                            edges {
                              node {
                                id
                                quantity
                              }
                            }
                        }
                    }
                    userErrors {
                      field
                      message
                    }
                }
            }

Is there a way to pass itemID to get the calculatedLineItemID of a specific line item?

 

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1453 238 498

Hey @vikasranjan - you should be able to do this using the OrderEditAddVariant mutation - once you add a new item to the order, it should automatically re-calculate the order. The orderEditBegin mutation is just used to trigger the order editing process - sort of like a failsafe so that orders aren't edited by mistake, if that makes sense. The only variable that is supported by that mutation is the order ID.

If you needed to remove an item from an order in addition to adding a new item, you can use the OrderEditSetQuantity mutation. Once the edits are complete you can then use the OrderEditCommit mutation to finalize the edit. 

Hope this helps - let us know if we can clarify anything further for you. 

 

Al | Shopify Developer Support.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ChrisNguyen
Shopify Partner
14 0 1

I know the OrderEditSetQuantity mutation but it needs a "ID of the calculated line item to edit" but I am confused about how to get this ID?

Shopicial - Community forum.
Xenforum - Customer Support forum.