return Approve Requestmutation
mutation
2024-10latest
Requires write
access scope or write
access scope. Also: The user must have return
permission.
Approves a customer's return request.
If this mutation is successful, then the Return.status
field of the
approved return is set to O
.
Arguments
The input fields to approve a return.
Was this section helpful?
ReturnApproveRequestPayload returns
The approved return.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: returnApproveRequest
Query Reference for MUTATION: returnApproveRequest
"mutation returnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n # Return fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: returnApproveRequest
"{\n \"input\": {\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"notifyCustomer\": true\n }\n}"
Schema Reference for MUTATION: returnApproveRequest
"input ReturnApproveRequestInput {\n id: ID!\n notifyCustomer: Boolean\n}\n"
Display Examples for MUTATION: returnApproveRequest
[ { "example": { "type_name": "returnapproverequest", "title": "Approve a return", "description": "Approve a return for the order.\n", "query_string": "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}", "variables": { "input": { "id": "gid://shopify/Return/945000959" } }, "response": { "data": { "returnApproveRequest": { "return": { "id": "gid://shopify/Return/945000959", "name": "#1001-R1", "status": "OPEN", "returnLineItems": { "edges": [ { "node": { "id": "gid://shopify/ReturnLineItem/677614676" } } ] }, "order": { "id": "gid://shopify/Order/311154583" } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/returns/test/unit/graph_api/admin/mutations/return_approve_request_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id name status returnLineItems(first: 1) { edges { node { id } } } order { id } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/945000959\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The input fields to approve a return.", "type": { "kind": "INPUT_OBJECT", "name": "ReturnApproveRequestInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ReturnApproveRequestInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Return/945000959\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "returnapproverequest", "title": "Cannot approve a return with an invalid status", "description": "Mutation fails if the return status is `CANCELED`.\n", "query_string": "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n}", "variables": { "input": { "id": "gid://shopify/Return/945000958" } }, "response": { "data": { "returnApproveRequest": { "return": null, "userErrors": [ { "code": "INVALID_STATE", "field": [ "input", "id" ], "message": "Return is not approvable. Only returns with status REQUESTED can be approved." } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/returns/test/unit/graph_api/admin/mutations/return_approve_request_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id status } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/945000958\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The input fields to approve a return.", "type": { "kind": "INPUT_OBJECT", "name": "ReturnApproveRequestInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ReturnApproveRequestInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Return/945000958\"}", "typeKind": "MUTATION" } ] } ]