Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Begin edit order api issue

Begin edit order api issue

Ankit16
Visitor
1 0 0

 

Hello,

 

We have been trying to edit an existing order with the Admin API . But api is working for some stores, but not for some stores. 

 

Using orderEditBegin is giving me a null for calculatedOrder . Reference: https://help.shopify.com/en/api/guides/editing-orders#begin-order-editing


Request : 

curl --location --request POST 'https://xxxxxxxxx.myshopify.com/admin/api/2022-10/graphql.json' \
--header 'Content-Type: application/graphql' \
--header 'X-Shopify-Access-Token: shpca_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--data-raw 'mutation beginEdit {
  orderEditBegin(id: "gid://shopify/Order/5095223525614") {
    calculatedOrder {
      id
      fulfilledLineItems: lineItems(first: 25, query: "editable:false") {
        edges {
          node {
            id
            title
            quantity
            hasStagedLineItemDiscount
            calculatedDiscountAllocations {
              discountApplication {
                id
              }
            }
          }
        }
      }
      unfulfilledLineItems: lineItems(first: 25, query: "editable:true") {
        edges {
          node {
            id
            title
            quantity
            variant {
              id
            }
            hasStagedLineItemDiscount
            calculatedDiscountAllocations {
              discountApplication {
                id
              }
            }
          }
        }
      }
    }
  }
}
'

Response :

 

{
    "data": {
        "orderEditBegin": {
            "calculatedOrder": null
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 189,
            "actualQueryCost": 10,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 990,
                "restoreRate": 50.0
            }
        }
    }
}

 

 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 518

Hi @Ankit16👋

 

To start, I'd recommend using the userErrors object to get more details on the reason the calculated order could not be created.

 

Generally, apps can edit orders that a Shopify channel creates (POS, Online Store, or drafts), or orders that this same app creates through the GraphQL Admin API - that is, the app making the edit needs to have created order. Another requirement to check would be that the order must be placed in your store currency.

 

 

 

mutation ($id: ID!) {
    orderEditBegin(id: $id){
        calculatedOrder{
            id
        }
        userErrors {
        }
    }
}

 

 

 

Hope that helps!

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