2016-04-13 14 views
0

Woocommerceの電子メールに請求の詳細(名前、電子メール、電話番号)を挿入するにはどうすればいいですか?Woocommerceの電子メールに請求の詳細を挿入するにはどうすればよいですか?

<tr> 
<th scope="row"><?php _e('Customer Email', 'woocommerce-appointments'); ?></th> 
<td>**HERE**</td> 
</tr> 
:私はこの(顧客名の例)に名前、電子メールと電話を挿入したい

<?php do_action('woocommerce_email_header', $email_heading); ?> 

<?php if ($appointment->get_order() && $appointment->get_order()->billing_first_name && $appointment->get_order()->billing_last_name) : ?> 
<p><?php printf($opening_paragraph, $appointment->get_order()->billing_first_name . ' ' . $appointment->get_order()->billing_last_name); ?></p> 
<?php endif; ?> 

<table> 
<tbody> 
    <?php if ($appointment->has_staff() && ($staff = $appointment->get_staff_member())) : ?> 
     <tr> 
      <th scope="row"><?php _e('Appointment Provider', 'woocommerce-appointments'); ?></th> 
      <td><?php echo $staff->display_name; ?></td> 
     </tr> 
    <?php endif; ?> 
    <tr> 
     <th scope="row"><?php _e('Appointment Date', 'woocommerce-appointments'); ?></th> 
     <td><?php echo $appointment->get_start_date(wc_date_format(), ''); ?></td> 
    </tr> 
    <tr> 
     <th scope="row"><?php _e('Appointment Time', 'woocommerce-appointments'); ?></th> 
     <td><?php echo $appointment->get_start_date('', get_option('time_format')) . ' &mdash; ' . $appointment->get_end_date('', get_option('time_format')); ?></td> 
    </tr> 
    <tr> 
     <th scope="row"><?php _e('Appointment Time', 'woocommerce-appointments'); ?></th> 
     <td><?php echo $appointment->get_start_date('', get_option('time_format')) . ' &mdash; ' . $appointment->get_end_date('', get_option('time_format')); ?></td> 
    </tr> 
</tbody> 
</table> 

<?php do_action('woocommerce_email_footer'); ?> 

:ここ

は、私は電子メールを送信するために使用していWoocommerce-予定のプラグインからのコードです

誰でも手伝っていただければ幸いです。

ありがとうございました。

+0

あなたは' do_action( 'woocommerce_email_customer_details'、$順、$ sent_to_admin、$ plain_text)を試してみましたか?このアクションフックは基本的に 'customer-processing-order.php'電子メールテンプレートからのもので、デフォルトで顧客情報(請求の詳細と配送の詳細)が電子メールに表示されます。私は他のプラグインの電子メールテンプレートでそれを使用しようとはしませんでしたが、私はうまくいくと思います。 – zipkundan

+0

これを読んだことがありますか:[** Woocommerceの電子メール - 請求情報の追加方法**](https://support.woothemes.com/hc/en-us/community/posts/202285577-Woocommerce-emails-how-課金情報を追加する)、少し古いですが面白いかもしれません... – LoicTheAztec

答えて

0

カスタムフィールドの名前をフックインして指定することで、注文電子メールに任意のカスタムフィールドを追加できます。

次のコードをテーマfunctions.phpにコピーし、WooCommerce> Checkout Fieldsに移動して、新しく作成したカスタムフィールドを追加します。この例を使用して enter image description here コードは次のようになります:

ここ

/** 
* Add the field to order emails 
**/ 
add_filter('woocommerce_email_order_meta_keys', 'my_woocommerce_email_order_meta_keys'); 


function my_woocommerce_email_order_meta_keys($keys) { 
    $keys['How did you hear about us?'] = 'hear_about_us'; 
    return $keys; 
} 

は、カスタムフィールドの設定は、ラベルされた「hear_about_us」を作成したWooCommerce>アウトフィールドのチェックアウトフィールドエディタの拡張機能を使用した例です。

$keys['How did you hear about us?'] = 'hear_about_us'; 
0

ありがとうございました。残念ながらどちらもうまくいきませんでしたしかし、私は出力に本当に簡単な方法で、名前、電子メールや電話を管理:; `

echo $appointment->get_order()->billing_first_name . ' ' . $appointment->get_order()->billing_last_name; 
echo $appointment->get_order()->billing_email; 
echo $appointment->get_order()->billing_phone; 
関連する問題