Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Automatically send order invoice to customer, once order is placed.
- *
- * Works only when order status is "pending".
- */
- function dctit_custom_woocommerce_pending_order_invoice_notification( $order_id ) {
- $order = wc_get_order( $order_id );
- //should not be doing anything, if order is not in pending status
- if( ! $order->has_status( 'pending' ) ) {
- return;
- }
- //send email
- WC()->mailer()->get_emails()['WC_Email_Customer_Invoice']->trigger( $order_id );
- }
- add_action( 'woocommerce_checkout_order_processed', 'dctit_custom_woocommerce_pending_order_invoice_notification', 20, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement