I think you just need to assign your quantity to the session variable you prefer, i used quantity
as last key, you might want to change it
$_SESSION['carro'][$id_producto]['quantity'] = $ncantidad;
Question
I'm trying to add a variable quantity in a $_SESSION variable and i don't know how to do it here is my code:
$cantidad=$_POST['cantidad'];
$ver=$_SESSION['carro'][$id_producto];
$ncantidad=$ver+$cantidad;
echo $ncantidad;
$_SESSION['carro'][$id_producto][$ncantidad];
In here cantidad is how many products of the same kind i want, then I try to add the actual number of product to the new one and then store it in the same variable
Thanks
Solution
I think you just need to assign your quantity to the session variable you prefer, i used quantity
as last key, you might want to change it
$_SESSION['carro'][$id_producto]['quantity'] = $ncantidad;
OTHER TIPS
I think you should wrote it like this:
$_SESSION['carro'][$id_producto]+=$ncantidad;
// echo $_SESSION['carro'][$id_producto];
see php session for further reading