2017-12-04 13 views

答えて

0

このようにして、顧客に送信される新しい注文電子メールにカスタムテキストを追加することができます。

add_action('woocommerce_before_email_order', 'add_product_welcome_email_text', 10, 2); 

function add_product_welcome_email_text($order, $sent_to_admin) { 

    if (! $sent_to_admin) { 

     foreach($order->get_items() as $item) { 
      $product = wc_get_product($item['product_id']); 

      // Use the name or product ID here 
      if($product->get_id() == 123) { 
       echo 'My custom welcome email text. Thanks for buying ' . $product->get_name(); 
      } 
     } 
    } 
} 
関連する問題