• Resolved John McCarthy

    (@john-lion)


    I’m attempting to save a simple text input to the WooCommerce session. The session is created when a user adds something to their cart.

    Here’s the code I’m using to set the data

    if( !is_admin( ) ) {
        // User input
        if( ! empty( $_POST['create_new_group'] ) ) {
            $group_input_value =  $_POST['create_new_group']; 
    
            // Set session and save data
            WC()->session->set( 'group_order_data', $group_input_value );
    
            wp_redirect( 'http://localhost:28/site.dev/checkout' );
            exit();
        }
    }

    It doesn’t set the data. Is this process correct or am I missing the point with setting sessions?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Saving data to WooCommerce session’ is closed to new replies.