最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

woocommerce offtopic - Add custom order meta to Order Completed email

programmeradmin6浏览0评论

On my order complete page I can do

echo get_post_meta( $order->get_id(), 'wpcf-purchase-student', true );

What would the equivalent be in the customer-order-completed.php email template?

On my order complete page I can do

echo get_post_meta( $order->get_id(), 'wpcf-purchase-student', true );

What would the equivalent be in the customer-order-completed.php email template?

Share Improve this question asked Sep 24, 2018 at 2:27 warm__tapewarm__tape 611 silver badge11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

paste the below code your active theme functions.php file

add_filter( 'woocommerce_email_order_meta_fields','custom_order_email_order_meta_data', 10, 3 );


function custom_order_email_order_meta_data( $fields, $sent_to_admin, $order ) {

$fields['wpcf-purchase-student'] = array(
    'label' => __( 'purchase amount', 'woocommerce' ),
    'value' =>  get_post_meta( $order->id, 'wpcf-purchase-student', true ) 
);
return $fields;
}
发布评论

评论列表(0)

  1. 暂无评论