Send a PDF invoice when an order is created, with Mechanic.

Mechanic is a development platform for Shopify. :)

Send a PDF invoice when an order is created

by Isaac Bowen (

Automatically generate an invoice PDF, to be emailed to the address on file for the order. Useful for working with billing departments, or with anyone else who needs an order summary auto-emailed. :)

Runs when an order is created. Configuration includes email subject, email body, pdf attachment filename, and pdf html template.

15-day free trial – unlimited tasks


This task automatically generates a PDF, based on the supplied HTML template. Configure to taste. To use a template from Order Printer, see this guide.

No email will be sent if the order does not have an email on file, or if the order's financial status is not "pending".

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

when an order is created (shopify/orders/create)
email subject (required), email body (multiline, required), pdf attachment filename (required), pdf html template (code, multiline, required)
{% if event.preview %}
  {% capture order_json %}
      "email": "",
      "financial_status": "pending"
  {% endcapture %}

  {% assign order = order_json | parse_json %}
{% endif %}

{% if != blank and order.financial_status == "pending" %}
  {% action "email" %}
      "to": {{ | json }},
      "subject": {{ options.email_subject__required | strip | json }},
      "body": {{ options.email_body__multiline_required | strip | newline_to_br | json }},
      "reply_to": {{ shop.customer_email | json }},
      "from_display_name": {{ | json }},
      "attachments": {
        {{ options.pdf_attachment_filename__required | json }}: {
          "pdf": {
            "html": {{ options.pdf_html_template__code_multiline_required | json }}
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Email subject
Attached: Invoice for order {{ }}
Email body

Thank you for your order! Please see the attached invoice for details and payment options.

{{ }}
Pdf attachment filename
invoice-{{ order.order_number }}.pdf
Pdf html template
<h1>Order {{ }} for {{ }}</h1>


  {% for line_item in order.line_items %}
      {{ line_item.quantity }} x {{ line_item.title }}: {{ line_item.price | money_with_currency }}
  {% endfor %}


  <li>Items: {{ order.total_line_items_price | money_with_currency }}</li>
  <li>Discounts: {{ order.total_discounts | money_with_currency }}</li>
  <li>Subtotal: {{ order.subtotal_price | money_with_currency }}</li>
  <li>Total (including taxes, shipping, tips): {{ order.total_price | money_with_currency }}</li>

<p>To arrange payment, contact {{ shop.customer_email }}.</p>