【问题标题】:How add field to the email report?如何在电子邮件报告中添加字段?
【发布时间】:2015-07-02 13:41:05
【问题描述】:

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

【问题讨论】:

  • 我投票结束这个问题,因为这不是一个明智的问题。
  • 请不要在问题标题中重复标签。

标签: 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);

这里是输出

经过测试。让我知道它是否对你有用。

【讨论】:

    猜你喜欢
    • 2021-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多