Redirect After Registration?

Is there a way to redirect a newly registered user back to the most recently viewed product page?

You can change redirect URL in the following file:

app/controllers/frontend/profiles.php

$redirect_url = "profiles.success_add";

You can change redirect URL in the following file:

app/controllers/frontend/profiles.php

$redirect_url = "profiles.success_add";

Don't you mean $return_url?

And doesn't this only apply to existing users? Seems like new users use $redirect_params['return_url'] which is derived from $_REQUEST['return_url'].

if (!empty(Tygh::$app['session']['recently_viewed_products'])) {
   $redirect_url = URL TO FIRST RECENTLY VIEWED PRODUCT;
} else {
   $redirect_url = "profiles.success_add";
}

So something like this?

if (!empty(Tygh::$app['session']['recently_viewed_products'])) {
   $redirect_url = URL TO FIRST RECENTLY VIEWED PRODUCT;
} else {
   $redirect_url = "profiles.success_add";
}

So something like this?

The logic is correct

Don't you mean $return_url?

And doesn't this only apply to existing users? Seems like new users use $redirect_params['return_url'] which is derived from $_REQUEST['return_url'].

No, the mentioned code is correct. New customers are redirected to profiles.success_add page