Sveiki, meklēju palīdzību.
   
foreach ($_SESSION['items'] as $value){
$products = $db->query("SELECT * FROM products WHERE id IN('$value')");
while ($product = $products->fetch_object()) {
echo  $product->name,' ',$product->price,'</br>';
 }
}

foreach( $db->query("Select SUM(price) FROM products WHERE id IN ('$value')") as $row){
echo  $row['SUM(price)'];
}

Iznākums

Kā lai panāku, ka SUM(price) summē dotos id($value) nevis parāda pēdējo?