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?

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.