I am adding a shortcode from wordpress to woocommerce email template.
do_shortcode('[sample_test name="additional_gift_msg"]);
Then i am using this to display the value in email. I am able to display value.
function th_email_shortcode_handler( $atts ) {
if ( ! empty( $atts['name'] ) ) {
$field = $atts['name'];
echo 'Found me';
}
}
add_shortcode('sample_test','th_email_shortcode_handler');
But i need $order
or $order_id
inside this handler function to take some value from post meta. How can i use those variables? The shortcode handler function is in functions.php