moltin / cart

Shopping cart composer package
Other
110 stars 62 forks source link

Inserting over a product in the cart. #18

Closed Nacoma closed 10 years ago

Nacoma commented 10 years ago

Using session, let's say we have:

$A = ["id" => "example", "quantity" => 5, ...];
// and
$B = ["id" => "example", "quantity" => 11, ...];

If we Cart::insert($A) we see from Cart::contents(true) that we have a quantity of 5.

However, using this same cart - if we Cart::insert($B) then examine the contents we see that we have a quantity of 11 until the script ends. At this point the quantity is once again 5 and the new information is not stored.

If this information were stored (not sure if intentional) then item updates would be much simpler in many cases.

Nacoma commented 10 years ago

Whoops, this should have been in laravel-cart, my mistake.