orderEditCommit return "Could not save the order edit."

Solved
evgeniy_simonov
New Member
5 0 0

Hello, I ran into a problem when changing the quantity in the LineItem
Changes are committed in CalculatedOrder and calculatedLineItem, but orderEditCommit returns
"message": "Could not save the order edit."

Sequencing:

1.

Request:

 

mutation beginEdit{
    orderEditBegin(id: "gid://shopify/Order/4186412679357"){
        calculatedOrder{
            id
            lineItems(first: 1) {
                edges {
                    node {
                        id
                    }
                }
            }
        }
    }
}

 

 

 Response: 

 

{
    "data": {
        "orderEditBegin": {
            "calculatedOrder": {
                "id": "gid://shopify/CalculatedOrder/21163114685",
                "lineItems": {
                    "edges": [
                        {
                            "node": {
                                "id": "gid://shopify/CalculatedLineItem/10653585375421"
                            }
                        }
                    ]
                }
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 13,
            "actualQueryCost": 13,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 987,
                "restoreRate": 50.0
            }
        }
    }
}

 

 

 

2.

Request:

 

mutation orderEditSetQuantity($id: ID!, $lineItemId: ID!, $quantity: Int!) {
    orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $quantity) {
        userErrors {
            field
            message
        }
        calculatedLineItem {
            id
            quantity
        }
        calculatedOrder {
            id
        }
    }
}

 

 

Response:

 

{
    "data": {
        "orderEditSetQuantity": {
            "userErrors": [],
            "calculatedLineItem": {
                "id": "gid://shopify/CalculatedLineItem/10653585375421",
                "quantity": 3
            },
            "calculatedOrder": {
                "id": "gid://shopify/CalculatedOrder/21163114685"
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 10,
            "actualQueryCost": 10,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 990,
                "restoreRate": 50.0
            }
        }
    }
}

 

 

 

3.

Request:

 

mutation orderEditCommit($id: ID!) {
    orderEditCommit(id: $id) {
        userErrors {
            field
            message
        }
        order {
            id
        }
    }
}

 

 

Response:

 

{
    "data": {
        "orderEditCommit": {
            "userErrors": [
                {
                    "field": [
                        "id"
                    ],
                    "message": "Could not save the order edit."
                }
            ],
            "order": null
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 10,
            "actualQueryCost": 10,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 990,
                "restoreRate": 50.0
            }
        }
    }
}

 

 

 

My Variables:

{
    "id": "gid://shopify/CalculatedOrder/21163114685",
    "lineItemId": "gid://shopify/CalculatedLineItem/10653585375421",
    "quantity": 2
}

 

Please tell me where I went wrong.

Accepted Solution (1)

Accepted Solutions
L_J_K
Shopify Staff
Shopify Staff
400 64 81

This is an accepted solution.

Hey @evgeniy_simonov 

Thanks for the request id. I've investigated and the inability to orderEditCommit happens as a result of a Fulfillment Service app that is used to initially open the fulfillment on this particular order. I note there is another app that opens the fulfilments, then fires another request to open it which fails.

The downstream effect is that when when the call is made to increase the quantity by 3 for that particular line item for Order Edit, there is a fulfillments error, and the Order Edit fails to commit as the fulfillment was handled by a Fulfillment app. The point that's it's specifically a fulfillments error doesn't propagate to the client though - I'm thinking that would be more helpful and I'll raise that with Our Edits team.

From the merchant perspective, merchants using Fulfillment Services apps should check with the Fulfillment apps directly to see if Fulfillments can be edited properly with Shopify's Order Edit functionality (we make mention of this in our docs). Hope this help explain a little more!

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Replies 6 (6)
L_J_K
Shopify Staff
Shopify Staff
400 64 81

Hey @evgeniy_simonov 

It likely will something to do with the state of the order. It would be worth querying the Order ID directly with something like this below, which should supply the reason in merchantEditableErrors why it can't be saved. Let me know how that goes! Thanks.

{
  order(id: "gid://shopify/Order/{Order_ID") {
    merchantEditable
    merchantEditableErrors
  }
}

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
evgeniy_simonov
New Member
5 0 0

Hey @L_J_K , 
I completed the request below is the response

{
    "data": {
        "order": {
            "merchantEditable": true,
            "merchantEditableErrors": []
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 1,
            "actualQueryCost": 1,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 999,
                "restoreRate": 50.0
            }
        }
    }
}


I don't get any errors, I will be grateful for any help in solving, thanks

L_J_K
Shopify Staff
Shopify Staff
400 64 81

Hey there @evgeniy_simonov 

Ah, that's strange! Ok, by any chance do you have the x-request-id from the headers for this call where you can't save the order? I'll be able to check out the logs and see what's behind this. Thanks!

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
evgeniy_simonov
New Member
5 0 0

@L_J_K Yes, very strange.
Here is X-Request-ID f5d8cc03-cd8a-4756-85cd-edb3b0f84d51. Thx.

L_J_K
Shopify Staff
Shopify Staff
400 64 81

This is an accepted solution.

Hey @evgeniy_simonov 

Thanks for the request id. I've investigated and the inability to orderEditCommit happens as a result of a Fulfillment Service app that is used to initially open the fulfillment on this particular order. I note there is another app that opens the fulfilments, then fires another request to open it which fails.

The downstream effect is that when when the call is made to increase the quantity by 3 for that particular line item for Order Edit, there is a fulfillments error, and the Order Edit fails to commit as the fulfillment was handled by a Fulfillment app. The point that's it's specifically a fulfillments error doesn't propagate to the client though - I'm thinking that would be more helpful and I'll raise that with Our Edits team.

From the merchant perspective, merchants using Fulfillment Services apps should check with the Fulfillment apps directly to see if Fulfillments can be edited properly with Shopify's Order Edit functionality (we make mention of this in our docs). Hope this help explain a little more!

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
evgeniy_simonov
New Member
5 0 0

Thank you very much for your help and clarification.
I would like to summarize.

You can edit the order itself before sending a Fulfillment request for it.
An order fulfillment can be edited before it goes to the status In Process and Canceled.


Thanks again for your help.