Anchor to section titled 'undefined'

returnApproveRequest
mutation

Requires write_returns access scope or write_marketplace_returns access scope. Also: The user must have return_orders permission.

Approves a customer's return request. If this mutation is successful, then the Return.status field of the approved return is set to OPEN.


The input fields to approve a return.


Was this section helpful?

The approved return.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
  returnApproveRequest(input: $input) {
    return {
      id
      name
      status
      returnLineItems(first: 1) {
        edges {
          node {
            id
          }
        }
      }
      order {
        id
      }
    }
    userErrors {
      code
      field
      message
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id name status returnLineItems(first: 1) { edges { node { id } } } order { id } } userErrors { code field message } } }",
 "variables": {
    "input": {
      "id": "gid://shopify/Return/945000959"
    }
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
    returnApproveRequest(input: $input) {
      return {
        id
        name
        status
        returnLineItems(first: 1) {
          edges {
            node {
              id
            }
          }
        }
        order {
          id
        }
      }
      userErrors {
        code
        field
        message
      }
    }
  }`,
  {
    variables: {
      "input": {
        "id": "gid://shopify/Return/945000959"
      }
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
    returnApproveRequest(input: $input) {
      return {
        id
        name
        status
        returnLineItems(first: 1) {
          edges {
            node {
              id
            }
          }
        }
        order {
          id
        }
      }
      userErrors {
        code
        field
        message
      }
    }
  }
QUERY

variables = {
  "input": {
    "id": "gid://shopify/Return/945000959"
  }
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
      returnApproveRequest(input: $input) {
        return {
          id
          name
          status
          returnLineItems(first: 1) {
            edges {
              node {
                id
              }
            }
          }
          order {
            id
          }
        }
        userErrors {
          code
          field
          message
        }
      }
    }`,
    "variables": {
      "input": {
        "id": "gid://shopify/Return/945000959"
      }
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
    returnApproveRequest(input: $input) {
      return {
        id
        name
        status
        returnLineItems(first: 1) {
          edges {
            node {
              id
            }
          }
        }
        order {
          id
        }
      }
      userErrors {
        code
        field
        message
      }
    }
  }
QUERY;

$variables = [
  "input" => [
    "id" => "gid://shopify/Return/945000959",
  ],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "input": {
    "id": "gid://shopify/Return/945000959"
  }
}
Hide code
Response
JSON
{
  "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": []
  }
}