Woocommerce, different order emails depending on product in order

I need to send two different “new_order” emails depending on the products ordered.
The case is that the products are stored at different locations and I need one email to be sent containing only the products present at storage 1, and the other mail containing the products present at storage 2.
If only products located at storage 1 was ordered, email 2 should not be sent at all, and vice versa.

The storage information is a custom meta field on each product.

I have added a custom email-class which is a copy of class-wc-email-new-order but only with changed name where needed.

I’ve been looking through the hooks and filters for this, but I was not able to go all the way. I’ve also been thinking about overriding the email-order-details.phpfile and check each products meta field, but I am not sure if that is the right way to go. I guess the email would still be sent even if there are no products in the table, so to speak.

My problem is that I don’t know which of the emails are sent out when using the different filters, so I cannot check that condition either.

Would you just create two new emails with templates and everything and go that way, or is it something I’m missing here?

If I can clarify anything, please let me know.

Read more here: Woocommerce, different order emails depending on product in order

Leave a Reply

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