【问题标题】:How add field to the email report?如何在电子邮件报告中添加字段?
【发布时间】:2015-07-02 13:41:05
【问题描述】:
【问题讨论】:
标签:
woocommerce
field
add
【解决方案1】:
您可以使用以下代码在电子邮件报告中添加字段
function wdm_custom_order_item_details($total_rows, $object){
$total_rows['custom Message']= array(
'label' => 'My Custom Message',
'value' => 'Custom information i want to see in order emails',
);
return $total_rows;
}
add_filter('woocommerce_get_order_item_totals','wdm_custom_order_item_details',10,2);
这里是输出
并使用此代码向订单页面添加字段
function wdm_admin_order_panel_after_shipping_address($order){
//use $order to get the details you want related to that order and display it here.
echo "<div><h4>My Custom Information</h4><p>Custom information i want to see in order details</p></div>";
}
//to add text after Shipping address of an order in admin panel
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'wdm_admin_order_panel_after_shipping_address' ,10,1);
这里是输出
经过测试。让我知道它是否对你有用。