Anchor to orderInvoiceSendorder
orderInvoiceSend
mutation
Requires access scope. Also: The user must have access to orders and manage orders information.
Sends an email invoice for an order.
Anchor to Arguments
Arguments
- Anchor to emailemail•
The email input fields for the order invoice. The
bcc
andfrom
fields should be store or staff account emails.- •ID!required
The order associated with the invoice.
Was this section helpful?
Anchor to OrderInvoiceSendPayload returnsOrderInvoiceSendPayload returns
- Anchor to orderorder•
The order associated with the invoice email.
- Anchor to userErrorsuser•
Errors [OrderInvoice non-nullSend User Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Send invoice
- orderInvoiceSend reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) {6 orderInvoiceSend(id: $orderId, email: $email) {7 order {8 id9 }10 userErrors {11 message12 }13 }14 }`,15 {16 variables: {17 "orderId": "gid://shopify/Order/17181286",18 "email": {19 "to": "test@example.net",20 "from": "Sales Modyl <salesmodel@example.com>",21 "subject": "Invoice #1001",22 "customMessage": "Thank you for your order"23 }24 },25 },26);2728const data = await response.json();29
mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) {
orderInvoiceSend(id: $orderId, email: $email) {
order {
id
}
userErrors {
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) { orderInvoiceSend(id: $orderId, email: $email) { order { id } userErrors { message } } }",
"variables": {
"orderId": "gid://shopify/Order/17181286",
"email": {
"to": "test@example.net",
"from": "Sales Modyl <salesmodel@example.com>",
"subject": "Invoice #1001",
"customMessage": "Thank you for your order"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) {
orderInvoiceSend(id: $orderId, email: $email) {
order {
id
}
userErrors {
message
}
}
}`,
{
variables: {
"orderId": "gid://shopify/Order/17181286",
"email": {
"to": "test@example.net",
"from": "Sales Modyl <salesmodel@example.com>",
"subject": "Invoice #1001",
"customMessage": "Thank you for your order"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation OrderInvoiceSend($orderId: ID!, $email: EmailInput) {
orderInvoiceSend(id: $orderId, email: $email) {
order {
id
}
userErrors {
message
}
}
}`,
"variables": {
"orderId": "gid://shopify/Order/17181286",
"email": {
"to": "test@example.net",
"from": "Sales Modyl <salesmodel@example.com>",
"subject": "Invoice #1001",
"customMessage": "Thank you for your order"
}
},
},
});
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 OrderInvoiceSend($orderId: ID!, $email: EmailInput) {
orderInvoiceSend(id: $orderId, email: $email) {
order {
id
}
userErrors {
message
}
}
}
QUERY
variables = {
"orderId": "gid://shopify/Order/17181286",
"email": {
"to": "test@example.net",
"from": "Sales Modyl <salesmodel@example.com>",
"subject": "Invoice #1001",
"customMessage": "Thank you for your order"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "orderId": "gid://shopify/Order/17181286",3 "email": {4 "to": "test@example.net",5 "from": "Sales Modyl <salesmodel@example.com>",6 "subject": "Invoice #1001",7 "customMessage": "Thank you for your order"8 }9}
Response
JSON1{2 "orderInvoiceSend": {3 "order": {4 "id": "gid://shopify/Order/17181286"5 },6 "userErrors": []7 }8}