Invoice is not being attached to Appointment emails
-
Yes, it gets attached to the new order email, but not the appointment one. The appointments are from Appointments for WooCommerce. The emails from them show up in WooCommerce settings and since they also show here in the PDF Invoice settings, I expected it to work.
thanks for your help!
Hi @jodzeee,
Please follow these steps to find out if the issue occurs before the message is sent:
- Install and activate the WP Mail Logging by MailPoet plugin
- Wait for the next Admin New Appointment notification.
- Then go to Tools > WP Mail Log, find your last Admin New Appointment email, and check if there are files in the Attachments column, and/or any notice on the Error column:

- Share the results with us 🙂
Hi Yordan. There are no errors. It successfully attaches and sends an .ics appointment file, but not the invoice.
Looking at the support forum at BookingWP, I found a topic that I think is the same problem. (I couldn’t find a matching topic in this, forum though.)
Unfortunately, I can’t link to the BookingWP forum topic because you need to be logged in to read it — but basically, you told them:Note that our plugin requires an order object to be passed to the email – if the BookingWP plugin does not pass the order object to the 3rd argument of woocommerce_email_attachments, then our plugin doesn’t have the source data to create the invoice.
They opened a ticket to add the functionality, but it hasn’t happened yet:
https://bitbucket.org/bookingwp/woocommerce-appointments/issues/947/woocommerce-pdf-invoices-packing-slips
They also said this:Would it help to know that you can get the order object from the appointment object like this
$appointment->get_product_id()?Will that code help make this happen?
Here’s some additional information I received when asking if they have ideas of how to make this happen:
Sadly, I cannot provide any code snippet to make this work. Because we’re using the filter to attach the ICS file and we’d pass the order object to all emails, then the appointment emails would contain the ICS for all appointments in the order (in case there are many) which makes no sense.
The best option I see is to ask the authors of the PDF invoices plugin if there is a filter you could use to get the order object in case one is not passed to it. Because in that case, you can get the order object from the appointment object like this:
$appointment->get_order()The whole code to check if the object is for an appointable product and if so to get the order object is:
// Check if the object is for an appointable product
if ( is_a( $object, 'WC_Appointment' ) ) {
// If it is, get the order object and store it to use later
$object = $object->get_order();
}Is there anything you can do to help get the invoice to attach to the Admin New Appointment email?
I can try writing a snippet a attaches the PDF for that appointment status. It will be a bit tricky since I don’t have access to that plugin. What is the status of the appointment called?
That would be great. The status is set to COMPLETED once they’ve paid for an appointment order. Is that what you mean?
Alternatively, are there any other email plugins that PDF Invoices works with other than WooCommerce native emails? For example, Follow-Ups or ShopMagic?
My apologies for the mix up. I was referring to the notification name, the one that is to be used in the filter. The status name is different than the notification name. You may need to ask the developers for this
Regarding the email plugins, we’re aware of the compatibility with those plugins you listed. If those plugins have a free option, you can always do some tests with them and our plugin
I believe it would be:
admin_new_appointment
If you could write a snippet, that would be wonderful!Hi @jodzeee,
Thanks for providing more details. Could you please write us to support@wpovernight.com, so we can continue investigating why that email notification is not attaching the PDF invoice? Please mention this topic.
We will be looking forward to your reply there!
The topic ‘Invoice is not being attached to Appointment emails’ is closed to new replies.
