Anchor to section titled 'undefined'

draftOrderInvoiceSend
mutation

Requires write_draft_orders access scope. Also: The user must have access to manage draft orders.

Sends an email invoice for a draft order.


Specifies the draft order invoice email fields.

Anchor to id
id
required

Specifies the draft order to send the invoice for.


Was this section helpful?

The draft order an invoice email is sent for.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
Copy
mutation draftOrderInvoiceSend($id: ID!) {
  draftOrderInvoiceSend(id: $id) {
    draftOrder {
      id
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation draftOrderInvoiceSend($id: ID!) { draftOrderInvoiceSend(id: $id) { draftOrder { id } } }",
 "variables": {
    "id": "gid://shopify/DraftOrder/276395349"
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation draftOrderInvoiceSend($id: ID!) {
    draftOrderInvoiceSend(id: $id) {
      draftOrder {
        id
      }
    }
  }`,
  {
    variables: {
      "id": "gid://shopify/DraftOrder/276395349"
    },
  },
);

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 draftOrderInvoiceSend($id: ID!) {
    draftOrderInvoiceSend(id: $id) {
      draftOrder {
        id
      }
    }
  }
QUERY

variables = {
  "id": "gid://shopify/DraftOrder/276395349"
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation draftOrderInvoiceSend($id: ID!) {
      draftOrderInvoiceSend(id: $id) {
        draftOrder {
          id
        }
      }
    }`,
    "variables": {
      "id": "gid://shopify/DraftOrder/276395349"
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation draftOrderInvoiceSend($id: ID!) {
    draftOrderInvoiceSend(id: $id) {
      draftOrder {
        id
      }
    }
  }
QUERY;

$variables = [
  "id" => "gid://shopify/DraftOrder/276395349",
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "id": "gid://shopify/DraftOrder/276395349"
}
Hide code
Response
JSON
{
  "draftOrderInvoiceSend": {
    "draftOrder": {
      "id": "gid://shopify/DraftOrder/276395349"
    }
  }
}