Horje
Add custom fields to my woocommerce completed email - Wordpress Solution
Hello, I am looking to modify my woocommerce completed email to show an order custom field. I need help outputting a custom field from an order that is used for the tracking number. I would like to use email hooks to output this field. I have been looking at this guide https://businessbloomer.com/woocommerce-visual-hook-guide-emails/ The custom fields are _aftership_tracking_number and _aftership_tracking_provider I attached a screenshot of where I want the ouput to locate in the email

Solution - 1

You can use following


Solution - 2

Please try this:

add_action( 'woocommerce_email_before_order_table', 'wc_email_before_order_table', 20 );
function wc_email_before_order_table( $order ) {
    $provider = get_post_meta( $order->get_id(),'_aftership_tracking_provider',true);
    $number = get_post_meta( $order->get_id(),'_aftership_tracking_number',true);
	echo sprintf( __( '<p>Tracking Provider: %s</p>', 'woocommerce' ), $provider );
	echo sprintf( __( '<p>Tracking Number: %s</p>', 'woocommerce' ), $number );
} 


Solution - 3

i think the below plugin should help you dude.. https://wordpress.org/plugins/aftership-woocommerce-tracking/





Wordpress

Related
Gallery Attachment Pagination X images per page - Wordpress Solution Gallery Attachment Pagination X images per page - Wordpress Solution
Plugin (?) issues after hosting migration. 500 error, cannot get on site or wp-admin. - Wordpress Solution Plugin (?) issues after hosting migration. 500 error, cannot get on site or wp-admin. - Wordpress Solution
How to email the same page's content at regular intervals, automatically? - Wordpress Solution How to email the same page's content at regular intervals, automatically? - Wordpress Solution
Gravity Forms - Populate Checkbox in Form from Multiple Single Line Text Input Answers from User - Wordpress Solution Gravity Forms - Populate Checkbox in Form from Multiple Single Line Text Input Answers from User - Wordpress Solution
Force DIV refresh upon coupon X application / removal - Wordpress Solution Force DIV refresh upon coupon X application / removal - Wordpress Solution

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12