getting error in returnCreate graphQl mutation

Solved

getting error in returnCreate graphQl mutation

omuni
Shopify Partner
2 0 0

using below query and variables to create a return, but getting error
query : 

mutation returnCreate($returnInput: ReturnInput!) {
returnCreate(returnInput: $returnInput) {
return {
status
}
userErrors {
field
message
}
}
}
 
variables : 
{
"returnInput": {
"notifyCustomer": true,
"orderId": "gid://shopify/Order/4962979217576",
"requestedAt": "2019-09-07T15:50:00Z",
"returnLineItems": [
{
"fulfillmentLineItemId": "gid://shopify/LineItem/12053660893352",
"quantity": 1,
"returnReason": "WRONG_ITEM",
"returnReasonNote": ""
}
]
}
}
 
response : 
{
"data": {
"returnCreate": null
},
"errors": [
{
"message": "invalid id",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"returnCreate"
]
}
],
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 1,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 999,
"restoreRate": 50.0
}
}
}
}
Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 509

This is an accepted solution.

Hi @omuni!
 

Your return input seems to include an Order LineItem, but the "fulfillmentLineItemId" field requires a FulfillmentLineItem. This is specified in the docs:

The ID of the fulfillment line item to be returned. Specifically, this field expects a FulfillmentLineItem.id.

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

View solution in original post

Replies 5 (5)

ShopifyDevSup
Shopify Staff
1453 238 509

This is an accepted solution.

Hi @omuni!
 

Your return input seems to include an Order LineItem, but the "fulfillmentLineItemId" field requires a FulfillmentLineItem. This is specified in the docs:

The ID of the fulfillment line item to be returned. Specifically, this field expects a FulfillmentLineItem.id.

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

mkobe
Shopify Partner
3 0 0

I'm experiencing the same issue.

{
  "returnInput": {
    "orderId""gid://shopify/Order/5258878976282",
    "requestedAt""2023-03-29T17:05:55Z",
    "returnLineItems": [
      {
        "fulfillmentLineItemId""gid://shopify/FulfillmentOrderLineItem/13857495875866",
        "quantity"1,
        "returnReason""UNKNOWN",
        "returnReasonNote"""
      }
    ]
  }
}
 
response:
{
    "data": {
        "returnCreate"null
    },
    "errors": [
        {
            "message""invalid id",
            "locations": [
                {
                    "line"3,
                    "column"3
                }
            ],
            "path": [
                "returnCreate"
            ]
        }
    ],
    "extensions": {
        "cost": {
            "requestedQueryCost"10,
            "actualQueryCost"1,
            "throttleStatus": {
                "maximumAvailable"1000.0,
                "currentlyAvailable"999,
                "restoreRate"50.0
            }
        }
    }
}
ShopifyDevSup
Shopify Staff
1453 238 509

Hey all - thanks for getting in touch - and for waiting on this response. I can't say for sure why your calls aren't working on my end without approval from the merchant to investigate further (or if you were to get in touch with us through our Partner Support team we can authenticate that way), but broadly speaking, you'll want to make sure you're using the fulfillment line item object here and not the fulfillment order line item object

To clarify, a fulfillment order is created automatically for inventory items that are associated with a particular fulfillment location/fulfillment service, and a fulfillment is what the location/service has control over - which is why you'd want to use the fulfillment line item object in this case. 

I'd just make sure to confirm that you're referencing the right type of line item as well as confirm if the ID number for the item is correct. This should resolve the issue, but let me know if you encounter any further errors - happy to keep digging into this. 

Hope this helps!

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

Stephen49
Visitor
2 0 0

Hello, I have also encountered the same problem. Have you resolved it now?

 

mkobe
Shopify Partner
3 0 0

I couldn't get past the error so I went with refundCreate did things a little different to keep the business process the same.