Discussing APIs and development related to customers, discounts, and order management.
Working with the draftOrderInvoiceSend mutation and I'm trying to override the email attributes as documented but only the default email is sent to the default recipient. All the EmailInput overrides do not work.
I have the mutation added as follows.
mutation draftOrderInvoiceSend($id: ID!, $email: EmailInput) {
draftOrderInvoiceSend(id: $id, email:$email ) {
draftOrder {
id
email
}
userErrors {
field
message
}
}
}
The variables are defined as follows.
{
"email": {
"bcc": [
"test-bcc@email.com"
],
"body": "Testing email with custom content",
"customMessage": "This is a message is an override",
"from": "no-reply@email.io",
"subject": "Email Subject",
"to": "sample@email.com"
},
"id": "gid://shopify/DraftOrder/945700241590"
}
Any ideas on what could be causing the issue?
Hi Paddy,
Are there any errors appearing when you run the mutation? Does your app have the write_draft_orders
access scope?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I realized that the action was reporting an error with the sender's email (from)
[
{
"field": null,
"message": "Sender is invalid"
}
]
The issue appears linked to the "from" attribute on the EmailInput variable. Switching it to the email set under Settings > Notifications or removing the attribute works, however, any other option fails.