bumbummen99 / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
501 stars 228 forks source link

Using Options or any array field in CartItem Throw not found this item in cart exception #186

Closed Yasser-ismail closed 1 year ago

Yasser-ismail commented 1 year ago

When using the array field in cartItem and trying to update it, the updateFromArray is called, In the last row in this function, the code generates a new rowId for the item, but the key of this item in the shopping cart did not change, so when trying to get content and find the item after the update, the exception is thrown.

So I think we should remove this line from the updateFromArray function in CartItem class: $this->rowId = $this->generateRowId($this->id, $this->options->all());

Cause when I commented on it the code ran successfully and no other functionality was affected by this change.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days