Why sometimes wp_redirect() reset cookie?

Question

I’ve been trying to set cookie to mark users that get redirected before checking out because of incompleted profile. The problem is when wp_redirect is executing and new page is opened, the set cookie dissapears. Here’s my code:

add_action('woocommerce_before_checkout_form',function(){
if (is_user_logged_in()){
$user = wp_get_current_user(); if ( bpprocn_has_incomplete_profile($user->id) ) {
wp_redirect(bp_core_get_user_domain( $user->id ) . bp_get_profile_slug() . '/edit/group/2'); exit; } } });  And you can see how the cookie was set for just a short while and disappears after the new page is loaded in this short video: https://www.loom.com/share/dbb549eb44204214b78263a1dfebc21a I’ve tried simplifying the context by doing this: if ($_GET['test'] ) {