簡體   English   中英

自定義電子郵件通知

[英]Custom email notification

我已將此代碼集成到自定義電子郵件中。 它可以工作,但是我想發送所有訂單詳細信息。 那可能嗎?

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 );
     }
   }

當然可以,只需將想要添加的內容一一添加:

$items = $order->get_items();

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM