I'm writing a small shopping cart facility on top of the codeignighter
framework.
Using the built in cart Class, I want to update a products price that has already being added to the cart.
This is similar to a coupon at the checkout point. I'm offering $5 off the current price of a particular product.
To me the code below looks ok but it's not updating the prices.
Anyone know why?
foreach ($this->cart->contents() as $item) {
if($item['id'] == 1) {
$item['price'] = $item['price'] - 5;
$this->cart->update($item);
}
}