returnClose mutation gives a not found error

Not sure what the actual cause of this is.
Whenever I’m trying to close a return, through the returnClose mutation, I get a “not found” error.
I know that i have the correct ID, thus I’m not sure what the actual cause of the problem is.
I have a case where customer returns should be closed without products being restocked, since the returned products must be evaluated and maybe repaired.
However there will be sent an exchange item, right away (so no refund is due), and when this is done, and the exhange item is fulfilled, the return should be closed.

Since we will handle fulfillment programatically through the API, we would also like to close the return programatically at the same time.
But this seems not to be possible, due to the “not found” error we get.
However we can close the return through the GUI whenever we like.

Any help would be much appreciated!

I’m not seeing any other reports of this internally - can you share the full mutation @MortenKL and any headerIds to dig into what might be happening here?

Hi Liam.
Actually I was using the GraphiQL app, to try this out before applying it to code.
Mutation body:

mutation returnClose($returnId: ID!){
  returnClose(id:$returnId){
    return{
      totalQuantity
      returnLineItems(first:10){
        nodes{
          id,
          quantity          
        }
      }      
    }
    userErrors {
      field,message,code
  	}
  }
}

Parameters:

  {
  	"returnId": "gid://shopify/Return/28802416810"  	
  }

This gives me the following error:

{
  "data": {
    "returnClose": {
      "return": null,
      "userErrors": [
        {
          "field": [
            "id"
          ],
          "message": "Return not found.",
          "code": "NOT_FOUND"
        }
      ]
    }
  }
}

Ok, this seems to be a problem with GraphiQL not being able to perform the mutation.
GraphiQL is probably missing some kind of permission for this.
Reinstalling and checking all possible permissions did not solve the issue with GraphiQL.
Running the mutation through a custom app actually works though, so that solved the core problem.. :slight_smile:

Hi Morten - you’re correct, it does seem to be an issue with using the GraphiQL app- possibly this restriction on the returnClose mutation:

The user must have return_orders permission.

Will look into how we can support this with GraphiQL, but in the meantime you can use a custom app as you’ve found.