我在產品中創建了一個名爲課程日期的自定義字段。我認爲它是一個日期,例如1月30日。這是我在電子郵件中沒有任何顯示..我錯過了什麼?代碼與新代碼片段編輯下面以新訂單顯示自定義產品字段電子郵件
<?php
/**
* Customer processing order email
*
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 2.4.0
*/
if (! defined('ABSPATH')) {
exit; // Exit if accessed directly
}
?>
<?php
$items = $order->get_items();
foreach ($items as $item) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
$course_date=get_post_meta($product_id, 'course-date', true);
//Note $course_date will get overwritten if there are more than one items in the order.
}
?>
<?php do_action('woocommerce_email_header', $email_heading); ?>
<p>This email is to notify you of your recent registration for the <b>Level 1 - Think and Grow Rich Institute Course</b>!</p>
<p>You are registered to attend on:</p>
<p><?php printf(__('<b>Registration ID:</b> %s', 'woocommerce'), $order->get_order_number()); ?></p>
<p><b>Course Registration Date:</b> <?php echo get_post_meta($post->id, 'course-date', true); ?></p>
<p><b>Time:</b> 8am Registration - 9am Event Begins (<a href="http://allfansnomoney.com/thinkandgrowrich/tentative-schedule/" target="_blank">See Full Schedule</a>)</p>
<p><b>Location:</b> 240 Belfield Rd, Toronto, ON M9W 1H3</p>
<p>If you have any questions please contact us by e-mail: <a href="mailto:[email protected]">[email protected]</a>.</p>
<p>Sincerely,<BR/>
The Think and Grow Rich Institute Team</p><BR/>
<p><em><b>"Whatever The Mind Can Conceive and Believe, It Will Achieve."</b> - Napoleon Hill</em></p>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text); ?>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text); ?>
<?php do_action('woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text); ?>
<?php do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text); ?>
<?php do_action('woocommerce_email_footer'); ?>
你如何定義'$ _product'?你如何將此代碼添加到電子郵件?哪裏?請編輯您的問題與額外的信息。 – helgatheviking
我已編輯幷包含完整的電子郵件模板。通過定義$ _product,我假設我必須添加一個片段或東西到functions.php?對不起還在學習 –
我可以僱用你爲我完成這件事嗎?我無法弄清楚,我需要儘快完成,請讓我知道。 –