2
votes

Could anyone tell me how to add a custom email variable to a shopify order notification?

For example, by default the order notification already contains the following:

  Shipping address
    {{ shipping_address.name }}
    {{ shipping_address.street }}
    {{ shipping_address.city }}, {{ shipping_address.province }}  {{ shipping_address.zip }}
    {{ shipping_address.country }}{% endif %}

These variables then translate into the actual shipping address of the customer in particular. Now I want to add a line of information from a third party source into this order notification, how would I go about this? I need a license key put in the Shopify order notification e-mail but this license key comes from a service outside of Shopify, is there any way I could make this happen one way or another?

2

2 Answers

1
votes

It is easy if you connect an App to your shop. You could then use the App to listen for orders via a Shopify Webhook. When you accept an order you can then trigger the code to generate or get a license key, and then just send an email to the customer with the license key and any other info you need to provide. This is a simple pattern to create.

1
votes

It’s not possible for Shopify to fetch the data from your external service while it puts together the email to send to the buyer, but you can use an orders/paid webhook to send the license key separately from your own server.

Edward, Shopify Developer Advocate