0

Is there a way to create a mailchimp form that redirects to a URL that takes the email variable of the form submitted?

For example the URL would be https://www.examplesite.co.uk/checkout/?EmailAddress=Test@test.com

Whereby Test@test.com is email they have just subsribed the form with.

I have code setup so that my website amends an input box so that their email is prefilled. I have also done this with the name but really I think I am just going to stick with the email. Below is the code.


`add_action( 'template_redirect', 'set_custom_data_wc_session' );
function set_custom_data_wc_session () {
    if ( isset( $_GET['tu_em'] ) || isset( $_GET['tu_name'] ) ) {
        $em   = isset( $_GET['tu_em'] )   ? esc_attr( $_GET['tu_em'] )   : '';
        $name = isset( $_GET['tu_name'] ) ? esc_attr( $_GET['tu_name'] ) : '';

        // Set the session data
        WC()->session->set( 'custom_data', array( 'email' => $em, 'name' => $name ) );
    }
}`

Any help with the form would be great as I am pulling my hair out here

I setup a subscribe form and cannot work out how to get the email variable and then redirect it to my URL

0 Answers0