> For the complete documentation index, see [llms.txt](https://docs.personaldiscount.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.personaldiscount.io/personal-discount-for-shopify/integrate-personal-discount-with-your-email-service-provider/shopify-notifications/how-to-send-an-order-confirmation-email-with-a-discount-code-in-shopify.md).

# How to send an order confirmation email with a discount code in Shopify?

Firstly open your **Shopify admin panel** > **Apps** > **Personal Discount**. Click the **Add automation** button. Select **Shopify** as your **Email Service Provider** and the **campaign type** - **Follow up on purchases**.

<figure><img src="/files/XwshdHTbjrEbK6aT03a7" alt="Add Personal Discount follow up on purchases automation animated"><figcaption><p>Add Personal Discount follow up on purchases automation</p></figcaption></figure>

In the next step fill out the form of your **automation details**. Here is a useful guide on [how to configure discount](/personal-discount-for-shopify/configure-discount.md).

Now **save** your automation and copy the code snippet to your clipboard.

<figure><img src="/files/1XjAHm5gQX5S96cG5Aeu" alt="Copy the code snipepet from Personal Discount annotated"><figcaption><p>Copy the code snippet from Personal Discount</p></figcaption></figure>

Navigate to **Settings** > **Notifications** > **Order confirmation** and insert your code snippet into your confirmation email template. If you are not sure where to place the code snippet, then the safest place is below the following line:

```html
<p>{{ email_body }}</p>
```

You can paste it for example here:

<figure><img src="/files/nQoyC3DDxvkDNyHNnARd" alt="Paste the code snippet into order confirmation template annotated"><figcaption><p>Paste the code snippet into order confirmation template</p></figcaption></figure>

Don't forget to save changes to your template.

<figure><img src="/files/6KLp8cTRrokvU2RO6MuQ" alt="Save Shopify order confirmation template annotated"><figcaption><p>Save Shopify order confirmation template</p></figcaption></figure>

When your customers place an order, they will receive a discount code for their next purchases, included in an order confirmation email.

<figure><img src="/files/0HnTnUUmb4ePnonWdEN4" alt="Shopify order confirmation with a discount code from Personal Discount"><figcaption><p>Shopify order confirmation with a discount code from Personal Discount</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.personaldiscount.io/personal-discount-for-shopify/integrate-personal-discount-with-your-email-service-provider/shopify-notifications/how-to-send-an-order-confirmation-email-with-a-discount-code-in-shopify.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
