Back to Community

How to Control Where Your WooCommerce PDF Invoices Are Sent

Content

One of the most common questions about the 'PDF Invoices & Packing Slips for WooCommerce' plugin is how to control exactly which email addresses receive the invoice PDF. Whether you want to send invoices to an accountant, prevent them from going to certain customers, or attach them to custom email notifications, this guide covers the primary methods available.

Understanding the Core Setting: "Attach To"

The most straightforward way to control invoice delivery is within the plugin's settings. Navigate to WooCommerce > PDF Invoices > Documents > Invoice > General. Here you will find the "Attach to" option.

This setting allows you to select the specific WooCommerce email notifications that will have the PDF invoice attached. For example, you can attach the invoice to the "Completed order" email sent to the customer, but disable it for the "New order" email sent to the admin. This is the simplest way to ensure invoices are only sent to the customer and not to your store's admin email.

Method 1: Using the Professional Extension's Order Notification

For more advanced scenarios, the 'PDF Invoices & Packing Slips for WooCommerce' team offers a Professional extension. A recurring solution mentioned in support threads is the Order Notification feature.

This feature is designed for situations like:

  • Sending a copy of every invoice to an accountant's email address.
  • Sending the invoice only to a secondary email address (like an employer), while the customer receives a standard confirmation without the PDF.
  • Triggering invoice emails based on custom conditions, such as a value selected from a checkout field.

The Order Notification acts as a separate, customizable WooCommerce email that can be configured with its own triggers and recipient list, giving you granular control over invoice distribution.

Method 2: Custom Code Snippets (For Developers)

If you have PHP knowledge, you can use filters provided by the plugin to create highly customized logic for sending invoices. Common use cases solved with code include:

Preventing Invoices for Specific Users or Roles

To disable invoices for certain user roles (e.g., wholesale customers who receive monthly invoices), you can use the wpo_wcpdf_document_is_allowed filter. This allows you to check the user's role and prevent the invoice from being generated or sent.

Conditionally Attaching Invoices Based on Order Data

You can use the wpo_wcpdf_custom_attachment_condition filter to attach invoices based on specific order metadata. For instance, you could attach the invoice only if a certain shipping method is used, or if a custom checkbox (e.g., "I want an invoice") was selected during checkout. The filter passes the order object, allowing you to check for shipping methods, product IDs, or custom fields.

Attaching Invoices to Custom Email Notifications

If you have a custom email notification that doesn't appear in the standard "Attach to" list, the plugin may still detect it if it's built using the standard WooCommerce email class. If it doesn't appear, you can use shortcodes like [wcpdf_download_pdf] or [wcpdf_document_link] to manually insert a link to the PDF within the email's content.

Troubleshooting Common Issues

  • Invoice not sending to a custom field email: If you've added code to send an invoice to an email address stored in a custom field, double-check that the meta key used in get_meta() matches exactly the key used to save the field value.
  • "Send PDF invoice" option missing from order actions: Ensure that the invoice is set to attach to the "Order details (Manual email)" option in the plugin settings. This controls the visibility of the option in the dropdown.
  • Invoice data not updating: The invoice is generated with the order data that existed at the time of creation. If a customer updates their address later, you may need to manually regenerate the invoice from the order admin screen for it to reflect the new information.

By combining the built-in settings with the advanced options from the Professional extension or custom code, you can achieve precise control over where and when your WooCommerce PDF invoices are sent.

Related Support Threads Support