定制电子邮件通知

时间:2017-01-05 10:30:24

标签: email woocommerce

我已为自定义电子邮件整合了此代码。它有效,但我想发送所有订单详情。这可能吗?

add_action("woocommerce_order_status_changed", "my_awesome_publication_notification");

function my_awesome_publication_notification($order_id, $checkout=null) {
   global $woocommerce;
   $order = new WC_Order( $order_id );
   $first_name = $order->billing_first_name;

   if($order->status === 'processing' ) {
      // Create a mailer
      $mailer = $woocommerce->mailer();
      $message_body = "<p>$first_name</p>";
      $message_body .= '<p>hat sich angemeldet für:</p>';



      $message_body .= '<p>Elisabeth Zangerle<br/>Koordinatorin FoBU</p>';

      $message = $mailer->wrap_message(
        // Message head and message body.
        sprintf( __( 'Fortbildung im Bezirk' ), $order->get_order_number() ),
                                                $message_body );


      // Cliente email, email subject and message.
     $mailer->send( $order->billing_company, sprintf( __( 'Fortbildung im Bezirk' ),
                    $order->get_order_number() ), $message );
     }
   }

1 个答案:

答案 0 :(得分:1)

当然可以,只需逐一添加你想要的东西:

$items = $order->get_items();

foreach($items as $item){
    print "Product Name: ".$item['name']."<br/>";
}