Woocommerce gives the option to add placeholders to the subject of an email. I'd like to expand on that ability by creating a custom placeholder that pulls information from woocommerce gravity forms product addons and woocommerce bookings.
I've tried Create additional variables/placeholders for Woocommerce email notifications subject code making some changes to see if I could make it work. Also, I tried getting the woocommerce meta fields but that didn't work either.
On this code I am not able to get the booking related to the order:
// For woocommerce versions up to 3.2
add_filter( 'woocommerce_email_format_string' , 'filter_email_format_string', 20, 2 );
function filter_email_format_string( $string, $email ) {
// Get the instance of the WC_Order object
$booking = $get_order;
// Additional wanted placeholders in the array (find / replace pairs)
$additional_placeholders = array(
'{custom_one}' => $booking->get_start_date(),
);
// return the clean string with new replacements
return str_replace( array_keys( $additional_placeholders ), array_values( $additional_placeholders ), $string );
}