Solved

How to send Invoice email through api after order is edited by "orderEditBegin" GraphQl Mutation ?

RitikaThakur
Shopify Partner
19 0 6

I am able to successfully edit the order & add custom item in the order using this documentation . But  I am not able to send invoice directly to customer after order edit because there  is no such order send invoice api  nor order/edit webhook provide me  checkout url to provide the customer to pay the new balance .

 

Although it provide "send invoice" button in admin areas of store : orders ->edit ->send invoice , which drop email to customer with checkout link to pay balance   . But I don't want my app merchant to do anything manually .

 

 

Accepted Solution (1)

Luke_K
Shopify Staff
402 66 98

This is an accepted solution.

Hey @RitikaThakur 

That's correct regarding the orders/edited hook - it wouldn't have the web url in the orders/edited payload.  One thing I'd noticed, were you including "notifyCustomer: true" in your OrderEditCommit call by chance? The reason I ask,  is that after including a Custom Item to the order then including notifyCustomer: true on my OrderEditCommit call on the GraphQL Admin API like the following :

mutation commitEdit {
  orderEditCommit(id: "gid:\/\/shopify\/CalculatedOrder\/xxxxxxxx", notifyCustomer: true, staffNote: "I edited the order! It was me!") {
    order {
      id
    }
    userErrors {
      field
      message
    }
  }
}

This would result in my customer associated to the order receiving an email like so with the Order Summary : 

shor1.png

Clicking 'Pay now' as a customer would direct me to the checkout. Let me know if I'm missing anything there though!

 

 

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Replies 2 (2)

Luke_K
Shopify Staff
402 66 98

This is an accepted solution.

Hey @RitikaThakur 

That's correct regarding the orders/edited hook - it wouldn't have the web url in the orders/edited payload.  One thing I'd noticed, were you including "notifyCustomer: true" in your OrderEditCommit call by chance? The reason I ask,  is that after including a Custom Item to the order then including notifyCustomer: true on my OrderEditCommit call on the GraphQL Admin API like the following :

mutation commitEdit {
  orderEditCommit(id: "gid:\/\/shopify\/CalculatedOrder\/xxxxxxxx", notifyCustomer: true, staffNote: "I edited the order! It was me!") {
    order {
      id
    }
    userErrors {
      field
      message
    }
  }
}

This would result in my customer associated to the order receiving an email like so with the Order Summary : 

shor1.png

Clicking 'Pay now' as a customer would direct me to the checkout. Let me know if I'm missing anything there though!

 

 

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
RitikaThakur
Shopify Partner
19 0 6

Thank You for your help ...