$curr_item = $curr_prod->type_price * $_SESSION['cart_qty'][$ajx_key]; $curr_item_disc = $promo_value * $_SESSION['cart_qty'][$ajx_key]; $new_temp_total = $curr_total - $curr_item; $new_temp_total_disc = $curr_discount - $curr_item_disc; $_SESSION['bag']['total'] = $new_temp_total; $_SESSION['bag']['discount'] = $new_temp_total_disc; $_ajax->update_temp_stock($temp_stock, $ajx_stock); /* --- DELETE BUY --- */ $_ajax->update_buy($_SESSION['cart_type_id'][$ajx_key]); unset($_SESSION['cart_type_id'][$ajx_key]); unset($_SESSION['cart_stock_id'][$ajx_key]); unset($_SESSION['cart_qty'][$ajx_key]); $temp_qty = 0; $sess_qty = $_SESSION['cart_qty']; foreach($sess_qty as $qty){ $temp_qty += $qty; } echo $temp_qty;