Graphql mutation returns "The order cannot be edited."

When I try to update an order using https://shopify.dev/docs/admin-api/graphql/reference/mutation/ordereditbegin?api[version]=2020-07 the server responds with { field: null, message: ‘The order cannot be edited.’ }. This happens for some countries like Ireland but does not happen for the US and UK. Does location determine whether I can edit orders?

2 Likes

Hey @evris_k ,

Location shouldn’t matter. Double check that you have the write_order_edits scope, and that the order is less than 60 days old. If it’s still not working, please provide a few example order_ids and we can investigate further.

Hey,

Getting the same issue (US-based) using a private app. I’ve verified the write_edit_orders scope is enabled via and the order is less than a day old.

Edit -

Some background, the query is firing after a draft order is created and completed. Firing an edit mutation on the same order id using the graphql API app works just fine. I am using the 2020_07 API. The same app is able to successfully create and complete draft orders with the same authentication.

I’ve enabled read/write for every order permission to make sure it didn’t have something to do with fulfilment.

Been working on this for a while and don’t see any other posts with this issue - please advise!

I know at least there is a restriction on orders created by the graphql API..I ended up just creating a new order based on the existing one and cancelling the old order.

I am also having this message: ‘message’: ‘The order cannot be edited.’

But the order is less than 60 days and I have the permissions. There are many orders being edited so permissions should be the cause.

Anyone has got a hint?

Unfortunately orders created by apps cannot be edited via the Shopify API - actually we can’t even edit them using the Shopify admin panel.

@davidhollenbeck

But I don’t think the order is created by another app. The order source name is web. Also, it’s not fulfilled yet.

It’s just one specific order that can’t be edited? Anything else weird about the order? - payment status, irregular/deleted/renamed line items, customer that changed their email after the order was fulfilled..anything that might trigger a ‘locked’ order status from Shopify

If you want to query the order with all properties (minus customer data) and drop the response here that might help!

@davidhollenbeck

Yes, it’s just 1 specific order. Some other orders from other stores can be processed. The last order from this store was also not processed and it’s from the same customer.

The financial status is paid. There is only 1 line item, which is the bundle item generated by my app. There is no discount. The fulfillment_status is null, not fulfilled yet.

I just share the order data in json here (minus customer data for sure):

{
    "order": {
        "id": 3908174610597,
        "admin_graphql_api_id": "gid://shopify/Order/1234",
        "app_id": 580111,
        "browser_ip": "1.2.3.4",
        "buyer_accepts_marketing": true,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": "34184d7f690bce44364bb51b78fe96a4",
        "checkout_id": 22392086986917,
        "checkout_token": "1a5a4a7403fd01c222e1b2dee1253a9b",
        "client_details": {
            "accept_language": "en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7",
            "browser_height": 573,
            "browser_ip": "1.2.3.4",
            "browser_width": 360,
            "session_hash": null,
            "user_agent": "Mozilla/5.0 (Linux; Android 10; EML-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36"
        },
        "closed_at": null,
        "confirmed": true,
        "contact_email": "abc@gmail.com",
        "created_at": "2021-06-24T21:38:29-04:00",
        "currency": "CAD",
        "current_subtotal_price": "20.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "20.00",
        "current_total_price_set": {
            "shop_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            }
        },
        "current_total_tax": "0.00",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            }
        },
        "customer_locale": "en",
        "device_id": null,
        "discount_codes": [],
        "email": "abc@gmail.com",
        "financial_status": "paid",
        "fulfillment_status": null,
        "gateway": "shopify_payments",
        "landing_site": "/",
        "landing_site_ref": null,
        "location_id": null,
        "name": "#1092",
        "note": null,
        "note_attributes": [],
        "number": 92,
        "order_number": 1092,
        "order_status_url": "https://xxx.com",
        "original_total_duties_set": null,
        "payment_gateway_names": ["shopify_payments"],
        "phone": null,
        "presentment_currency": "CAD",
        "processed_at": "2021-06-24T21:38:28-04:00",
        "processing_method": "direct",
        "reference": null,
        "referring_site": "https://www.google.com/",
        "source_identifier": null,
        "source_name": "web",
        "source_url": null,
        "subtotal_price": "20.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            }
        },
        "tags": "",
        "tax_lines": [],
        "taxes_included": false,
        "test": false,
        "token": "b01f60a098c60371963374bbfbadf2ce",
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            }
        },
        "total_line_items_price": "20.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            }
        },
        "total_outstanding": "0.00",
        "total_price": "20.00",
        "total_price_set": {
            "shop_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "20.00",
                "currency_code": "CAD"
            }
        },
        "total_price_usd": "16.25",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            }
        },
        "total_tax": "0.00",
        "total_tax_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "CAD"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 710,
        "updated_at": "2021-06-24T21:38:33-04:00",
        "user_id": null,
        "billing_address": {
            
        },
        "customer": {
           
        },
        "discount_applications": [],
        "fulfillments": [],
        "line_items": [{
                "id": 10086197559461,
                "admin_graphql_api_id": "gid://shopify/LineItem/10086197559461",
                "fulfillable_quantity": 1,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 710,
                "name": "Create your own box! - Bundle31_2021-06-24T21:12:23-04:00 / [(37170561777829, 1), (40081553850533, 1), (40162641019045, 1), (39771950678181, 1)]",
                "origin_location": {
                    "id": 2494784700581,
                    "country_code": "CA",
                    "province_code": "ON",
                    "name": "My STORE",
                    "address1": "xxx",
                    "address2": "",
                    "city": "yyy",
                    "zip": "zzz"
                },
                "price": "20.00",
                "price_set": {
                    "shop_money": {
                        "amount": "20.00",
                        "currency_code": "CAD"
                    },
                    "presentment_money": {
                        "amount": "20.00",
                        "currency_code": "CAD"
                    }
                },
                "product_exists": true,
                "product_id": 6710901735589,
                "properties": [{
                        "name": "1",
                        "value": "A Unicorn"
                    }, {
                        "name": "2",
                        "value": "B Worry"
                    }, {
                        "name": "3",
                        "value": "C Red"
                    }, {
                        "name": "4",
                        "value": "D Blue"
                    }
                ],
                "quantity": 1,
                "requires_shipping": true,
                "sku": "",
                "taxable": true,
                "title": "Create your own box!",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "CAD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "CAD"
                    }
                },
                "variant_id": 40235319951525,
                "variant_inventory_management": "shopify",
                "variant_title": "Bundle31_2021-06-24T21:12:23-04:00 / [(37170561777829, 1), (40081553850533, 1), (40162641019045, 1), (39771950678181, 1)]",
                "vendor": "BYOB",
                "tax_lines": [],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_details": {
            
        },
        "refunds": [],
        "shipping_address": {
          
        },
        "shipping_lines": [{
                "id": 3315938132133,
                "carrier_identifier": null,
                "code": "Local Delivery",
                "delivery_category": null,
                "discounted_price": "0.00",
                "discounted_price_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "CAD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "CAD"
                    }
                },
                "phone": "1234",
                "price": "0.00",
                "price_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "CAD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "CAD"
                    }
                },
                "requested_fulfillment_service_id": null,
                "source": "shopify",
                "title": "Local Delivery",
                "tax_lines": [],
                "discount_allocations": []
            }
        ]
    }
}

Thanks -

It look like the line item is generated by your bundle app - based on the time stamp dynamically generated, not from static product in Shopify - so even if it goes through Shopify payments I wonder if that would have something to do with it? Are any other bundle orders getting the same error?

@davidhollenbeck

I check 3 other successful orders. The orders’ gateways are using PayPal, authorize.net & afterpay. This failed order is using Shopify payments.

From the docs, I don’t see there is a correlation between payment gateway and edit orders?

Reference:

Edit an existing order with Admin API: https://shopify.dev/tutorials/edit-an-existing-order-with-admin-api

Editing orders: https://help.shopify.com/en/manual/orders/edit-orders