moltin / cart

Shopping cart composer package
Other
110 stars 62 forks source link

Can't get item by its identifier #12

Closed joarobles closed 10 years ago

joarobles commented 11 years ago

I can´t get an item by its ID, I'm trying to remove it from the cart but I obtain:

Call to a member function toArray() on a non-object

I can reproduce the issue like this:

foreach (Cart::contents() as $item) {
    \Log::info ('ID: '. $item->id); // Outputs "42" (integer)
    \Log::info ('Item', Cart::item ($item->id)->toArray ()); // error
}

Also I can't remove the item using

Cart::item((string) $id)->remove()