Я хочу добавить уведомление к электронному письму «новый заказ», отправляемому администраторам перед таблицей, чтобы, если клиент заплатил «Заказом на покупку», команда обработки знала, что платеж ожидается.
Исследования и работы выполнены: Я потратил некоторое время на изучение различных документов и документов и придумал код Версия 1 , но он ничего не показывает в электронном письме заказа (Я изменил код Версия 2 и попытался снова, но безрезультатно).Коды неправильные?Я просто хочу подтвердить, прежде чем искать другие варианты.Спасибо
Версия 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 );
Версия 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 );