如何在电子邮件报告中添加字段?

时间:2015-07-02 13:41:05

标签: woocommerce field add

如何在电子邮件报告中添加字段? http://www.evernote.com/l/Ac2uV87BrP9G9L7eKZplR1x3LrsGs-Yfsm8/ 和 如何在订单页面添加字段 http://www.evernote.com/l/Ac1m-Ah7v71P9Zv3dmbIPXlHdxnrr9T7WkA/

1 个答案:

答案 0 :(得分:0)

您可以使用以下代码在电子邮件报告中添加字段

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);

这里的输出将是

enter image description here

并向订单页面添加字段使用此代码

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);

这里的输出将是

enter image description here

测试。让我知道它是否适合你。