Home Forums Plugins WooCommerce Thank You Page Customizer not thank you page for not log in users

not thank you page for not log in users

  • Author
    Posts
  • #184163

    scaballe
    Participant

    I have modified woocommerce for
    that allows a registered user to place an order without being logged in,

    with this code:

    // Create user if one does not exist
    function tn_checkout_create_acct( $post_data ) {
    	$user = get_user_by( 'email', $post_data['billing_email'] );
    	if ( $user ) {
    		$post_data['createaccount'] = 0;
    	} else {
    		$post_data['createaccount'] = 1;
    	}
    	return $post_data;
    }
    
    add_filter('woocommerce_checkout_posted_data', 'tn_checkout_create_acct');
    
    // Attach order to existing account if user not logged in
    function tn_checkout_set_customer_id( $current_user_id ) { 
    	if ( !$current_user_id ) {
    		$user = get_user_by('email', $_POST['billing_email']);
    		if ( $user ) {
    			$current_user_id = $user->ID;
    		}
    	}
    	return $current_user_id;
    } 
    
    add_filter('woocommerce_checkout_customer_id', 'tn_checkout_set_customer_id');
    
    

    If a user (not log in) places an order, the thankyou page does not appear, it asks them to log in with their username and password,

    Previously I used the Custom Thank You Pages plugin it worked well
    but this is not compatible with wpml

    is it possible to fix this

You must be logged in to see replies to this topic. Click here to login or register