I am trying to send the customer an invoice once an order has been placed, and the user reaches the thankyou page.
I thought i could use the following:
function sendinvoice($orderid)
{
$email = new WC_Email_Customer_Invoice();
$email->trigger($orderid);
}
add_action('woocommerce_thankyou','sendinvoice');
But on the thank you page i then see the following error:
Fatal error: Class 'WC_Email_Customer_Invoice' not found in /***/index.php on line 174
Any ideas on how i can resolve this?