2017-01-05 4 views
0

私はカスタムメール用にこのコードを統合しました。それは動作しますが、私はすべての注文の詳細を送信したいと思います。それは可能ですか?カスタムメール通知

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

確かに、ただ1つによって、あなたが望むものは何でも追加可能です:唯一の製品名ではなく、管理者の順序を示し

$items = $order->get_items(); 

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

はい、。 :-( –

+0

管理者の注文はどういう意味ですか? –

+0

管理者は注文メールを受け取ります。このメールには価格などの注文があります。これは正確に表示することができます。 –