billing_email, $subject, $message ); } /** * Completed order notification email template - this one includes download links for downloadable products **/ add_action('woocommerce_order_status_completed', 'woocommerce_completed_order_customer_notification'); function woocommerce_completed_order_customer_notification( $id ) { global $order_id, $email_heading; $order_id = $id; $order = &new woocommerce_order( $order_id ); $email_heading = __('Order Complete', 'woothemes'); $subject = '[' . get_bloginfo('name') . '] ' . __('Order Complete', 'woothemes'); // Buffer ob_start(); // Get mail template woocommerce_get_template('emails/customer_completed_order.php', false); // Get contents $message = ob_get_clean(); // Send the mail woocommerce_mail( $order->billing_email, $subject, $message ); } /** * Pay for order notification email template - this one includes a payment link **/ function woocommerce_pay_for_order_customer_notification( $id ) { global $order_id, $email_heading; $order_id = $id; $order = &new woocommerce_order( $order_id ); $email_heading = __('Pay for Order', 'woothemes'); $subject = '[' . get_bloginfo('name') . '] ' . __('Pay for Order', 'woothemes'); // Buffer ob_start(); // Get mail template woocommerce_get_template('emails/customer_pay_for_order.php', false); // Get contents $message = ob_get_clean(); // Send the mail woocommerce_mail( $order->billing_email, $subject, $message ); } /** * Low stock notification email **/ function woocommerce_low_stock_notification( $product ) { $_product = &new woocommerce_product($product); $subject = '[' . get_bloginfo('name') . '] ' . __('Product low in stock', 'woothemes'); $message = '#' . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('is low in stock.', 'woothemes'); $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); wp_mail( get_option('admin_email'), $subject, $message ); } /** * No stock notification email **/ function woocommerce_no_stock_notification( $product ) { $_product = &new woocommerce_product($product); $subject = '[' . get_bloginfo('name') . '] ' . __('Product out of stock', 'woothemes'); $message = '#' . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('is out of stock.', 'woothemes'); $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); wp_mail( get_option('admin_email'), $subject, $message ); } /** * Backorder notification email **/ function woocommerce_product_on_backorder_notification( $product, $amount ) { $_product = &new woocommerce_product($product); $subject = '[' . get_bloginfo('name') . '] ' . __('Product Backorder', 'woothemes'); $message = $amount . __(' units of #', 'woothemes') . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('have been backordered.', 'woothemes'); $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); wp_mail( get_option('admin_email'), $subject, $message ); }