I'm in a virtual store project, but I have the following dilemma. A certain user accesses the store and places a product in the cart. I'm storing purchases in a DB table as it gets easier to have a drop / cart dropout control, however the user data I'm storing as follows:
if(!isset($_SESSION["SESSIONID"])){
$dataHora = date("Y-m-d H:i");
$sessionID = md5($ip.$dataHora);
$_SESSION["SESSIONID"] = $sessionID;
}else{
$sessionID = $_SESSION["SESSIONID"];
}
I set the date and time after the IP if the user is accessing from a network, such as work network, so if another user accesses the store through this network, you will not see the purchase of another user from another computer (correct me if I'm wrong).
But what if the user closes the browser without completing the purchase? When you return, the cart will be empty. I thought about storing in Cookie, but what if the browser is not accepting cookies? Is there any other way?