Automatically Email Invoices in WooCommerce (PDF + Custom Design)

WooCommerce automatic invoice email setup with PDF attachment and branding

If you’re running an ecommerce store, sending invoices manually is a waste of time. This guide shows you how to automatically email invoices in WooCommerce — with professionally branded PDFs attached to every order email. Whether you’re selling B2B, physical goods, or digital products, this workflow is a must.

We’ll cover:

  • ✅ How to send automatic PDF invoices on order complete
  • ✅ How to customize the invoice design with your logo & layout
  • ✅ Code-free and developer-level options
  • ✅ Bonus: Attach invoice to customer note and admin emails

Why Send Automatic Invoice Emails in WooCommerce?

  • 🧾 Legal and tax compliance for B2B and international orders
  • 📩 Improved professionalism and customer trust
  • ⏱️ Saves time vs manually generating invoices
  • 🖨️ Easy PDF download for record keeping

Option 1: Use a Plugin (No Code Required)

🛠 Recommended Plugin: WooCommerce PDF Invoices & Packing Slips

This plugin automatically generates and attaches a PDF invoice to the customer’s order email. It also allows for invoice numbering, logo upload, footer notes, and more.

✅ Setup Instructions:

  1. Install the plugin from Plugins → Add New → Search “PDF Invoices”
  2. Go to WooCommerce → PDF Invoices
  3. Upload your logo and adjust company details
  4. Set which email(s) to attach the PDF (Order Completed, Customer Invoice, etc.)

🧠 Bonus:

Upgrade to their Professional extension to:

  • Change layout with drag-and-drop designer
  • Attach custom terms & conditions
  • Send credit notes or proforma invoices

Option 2: Programmatic Method Using WooCommerce Hooks (Dev Level)

Want to control how invoices are created or emailed? You can hook into order actions and attach your own PDFs.

🧩 Hook into the Completed Order Email

add_filter('woocommerce_email_attachments', 'attach_custom_invoice_pdf', 10, 3);
function attach_custom_invoice_pdf($attachments, $email_id, $order) {
 if ($email_id === 'customer_completed_order') {
 $upload_dir = wp_upload_dir();
 $pdf_path = $upload_dir['basedir'] . '/invoices/invoice-' . $order->get_id() . '.pdf';
 if (file_exists($pdf_path)) {
 $attachments[] = $pdf_path;
 }
 }
 return $attachments;
}

This checks if a PDF exists for the order and attaches it to the email. You’d need a custom function elsewhere to generate and save the PDF.

📄 How to Generate the PDF?

Use libraries like mPDF or DOMPDF to create invoice PDFs dynamically. Here’s a sample of how to create a basic one:

require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$order = wc_get_order($order_id);
$html = '<h1>Invoice #' . $order->get_id() . '</h1>';
$html .= '<p>Customer: ' . $order->get_billing_first_name() . '</p>';
$mpdf->WriteHTML($html);
$upload_dir = wp_upload_dir();
$mpdf->Output($upload_dir['basedir'] . '/invoices/invoice-' . $order->get_id() . '.pdf', \Mpdf\Output\Destination::FILE);

Trigger this after order status is marked as “completed” using:

add_action('woocommerce_order_status_completed', 'generate_invoice_pdf');
function generate_invoice_pdf($order_id) {
 // Your custom PDF generation logic goes here
}

Customizing the Invoice Design

If you’re using the plugin, go to PDF Invoices → Templates and:

  • ✅ Upload your company logo
  • ✅ Adjust header, footer, and font sizes
  • ✅ Include legal or tax info like VAT or EIN numbers

If you’re using your own PDF library, you can fully style the PDF with HTML/CSS inside the WriteHTML() method.


Sending Invoices on Different Email Types

You can attach invoices to multiple WooCommerce email types using the same woocommerce_email_attachments filter. Just check for:

  • customer_invoice
  • customer_processing_order
  • new_order (admin notification)

Final Thoughts

Automatically emailing WooCommerce PDF invoices boosts your professionalism and ensures customers always have the documents they need — without lifting a finger.

Whether you use a no-code plugin or code it from scratch with mPDF or DOMPDF, you’ll end up with a fast, scalable solution that saves time and enhances your brand.

Need help building a custom PDF invoice engine or automating your order flows? Contact Babar Ilyas for custom WooCommerce automation & dev work.

Looking to go deeper? Check out our guide on automating abandoned cart emails or learn to add dynamic checkout fees.

FAQs: WooCommerce Automatic Invoice Emails

You can use a plugin like WooCommerce PDF Invoices & Packing Slips to automatically attach invoices to customer emails, or add custom code with WooCommerce hooks.

The most trusted plugin is WooCommerce PDF Invoices & Packing Slips. It’s free, easy to set up, and supports customization and automation.

Yes. You can upload your logo, add company details, change layout styles, and even use HTML/CSS if building custom templates with libraries like mPDF or DOMPDF.

You can attach invoices to email types like customer_completed_ordercustomer_invoicenew_order, and more using the woocommerce_email_attachments filter.

Use a PHP PDF library like mPDF or DOMPDF to generate invoice content dynamically, then save and attach the PDF using woocommerce_order_status_completed and related hooks.

Yes. You can write conditional logic inside your email or invoice generation hooks to attach different PDFs based on order properties like payment gateway, location, or items.

Yes. With plugins or custom templates, you can include VAT numbers, sequential invoice numbers, and all required legal elements to stay compliant.

Use the woocommerce_email_attachments hook and check for the email ID new_order to attach a PDF invoice to admin notifications.

Most PDF invoice plugins add a download link in the WooCommerce My Account → Orders section, allowing customers to re-download invoices anytime.

Yes, as long as you store them outside the public web root or in a protected directory like /wp-content/uploads/invoices/ and use unique file names per order.

Leave a Reply

Your email address will not be published. Required fields are marked *

    Branding Design Development Front-End Website-Redesigning Shopify-Development WordPress-Development
    Branding Design Development Front-End Website-Redesigning Shopify-Development WordPress-Development
    We love crafting unforgettable
    digital experiences, brands and websites with people like you.
    Follow us:
    Let’s get started
    We'd love to hear about your project.
    © 2025 babarilyas. All rights reserved.