• 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. Searching on forums I have found various options using php but nothing seems to work.

    I have also tried doing it using Contact Form 7 but without success.

Viewing 1 replies (of 1 total)
  • Thread Starter charliemp

    (@charliemp)

    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

Viewing 1 replies (of 1 total)
  • The topic ‘mailto populate subject with product title’ is closed to new replies.