I want to add a notice to "new order" email sent to admins before the table so if customer paid with "Purchase Order", processing team will know the payment is pending.
Research & Work Done: I spent some time researching various tuts and docs and came up with the Version 1 code but it's not showing anything on the order email (I changed the code Version 2 and tried again but to no avail). Are the codes wrong? I just want to confirm before I look into other options. Thank you
Version 1
/* Payment pending instruction if payment method is "Purchase Order" */
function add_order_instruction_email( $order, $sent_to_admin, $plain_text, $email ) {
if ( $sent_to_admin ) {
echo '<p><strong>Payment Method:</strong> '.$order->payment_method_title().'</p>';
if ( 'Purchase Order' == $order->get_payment_method_title() ) {
/* if purchase order method is used */
echo '<p><strong>Note:</strong> Payment is pending, please contact customer for payment before processing order for shipping.</p>';
}
}
}
add_action( 'woocommerce_before_email_order_table', 'add_order_instruction_email', 20, 4 );
Version 2
/* Payment pending instruction if payment method is "Purchase Order" */
function add_order_instruction_email( $order, $sent_to_admin, $plain_text, $email ) {
if ( $email->id == 'new_order' ) {
echo '<p><strong>Payment Method:</strong> '.$order->payment_method_title().'</p>';
if ( 'Purchase Order' == $order->get_payment_method_title() ) {
/* if purchase order method is used */
echo '<p><strong>Note:</strong> Payment is pending, please contact customer for payment before processing order for shipping.</p>';
}
}
}
add_action( 'woocommerce_before_email_order_table', 'add_order_instruction_email', 10, 2 );