Cookie error. No possibility to define my cookie

You are missing the path parameter.
Try setcookie( 'panier', $cookie_user_id, time() + DAY_IN_SECONDS, "https://wordpress.stackexchange.com/");

Also, don’t put the callback function in a conditional, put the conditional statement inside the function.