当用户在 WooCommerce Bookings 进行预订时,我想通过电子邮件通知双方 用户和管理员 强>。 现在它只向管理员发送邮件以确认预订。
任何人都可以给我正确的方向,以及如何实现这一目标。 谢谢。
最佳答案
这是小菜一碟。
function my_awesome_shipping_notification($order_id, $checkout = null) {
global $woocommerce;
$order = new WC_Order($order_id);
if ($order->status === 'on-hold') {
// Create a mailer
$mailer = $woocommerce->mailer();
$message_body = __('Order placed: Waiting for confirmation.', 'text_domain');
$message = $mailer->wrap_message(
// Message head and message body.
sprintf(__('Order %s ready for shipping', 'text_domain'), $order->get_order_number()), $message_body);
// Client email, email subject and message.
$result = $mailer->send($order->billing_email, sprintf(__('Order %s received', 'text_domain'), $order->get_order_number()), $message);
//error_log( $result );
}
}
add_action('woocommerce_order_status_changed', 'my_awesome_shipping_notification');
希望这对您有所帮助。
引用: [ https://docs.woocommerce.com/document/bookings-action-and-filter-reference/][1]
关于php - 用户使用 Woocommerce Booking 进行预订时如何发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39890277/