Before I ask this question, I know there is a (legitimate) hesitation to answer questions here about Woo products since they have their own support and their users should be encouraged to use that. I am a paying Woo user but couldn't solve this with their paid support, and my question is about overriding classes in WP so I hope it will get a fair hearing.
My question: when a completed order email is sent out to a customer, I also need to receive this email, verbatim and automatically, exactly as it is sent to the customer rather than in some other format such as is created by the various invoice PDF plugins for WooCommerce. I can very easily accomplish this by changing the following line in /woocommerce/classes/emails/class-wc-email-customer-completed-order.php
:
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
to read:
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
$this->send( [email protected], $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
However, obviously a hack like this isn't going to survive an upgrade. I have a child theme which overrides WooCommerce templates. Is there any equivalent mechanism by which I can override a class in a similarly encapsulated way? Or can you recommend an alternate approach (besides setting the SMTP server to bcc all outgoing emails to the second address) for accomplishing my specific task of receiving this email when the customer also receives it?