I have a woocommerce site and want to have a mailto button for more information. I want the email to automatically populate the subject field with the product (post) title. I have found various options using php but nothing seems to work.
I have tried using the following mailto:
mailto:[email protected]?subject=Info request for [custom_mailto_title]
and then this php:
add_shortcode( ‘custom_mailto_title’, ‘custom_mailto_title’ );
function custom_mailto_title( $atts ) {
return esc_attr( get_the_title( get_the_ID() ) );
}
It looks like it should work but it does not and my understanding of php is limited