laravel-cart-manager
laravel-cart-manager copied to clipboard
Remove specific product in all users carts
Is your feature request related to a problem? Please describe. Let's say a product is no longer available. It has to be removed from all carts immediately so that users' won't buy those items.
Describe the solution you'd like
From the documentation, I cannot find how to update all users' carts with the available methods. Does cart() method apply to all users or just the current user?
Describe alternatives you've considered I tried fetching all carts that include the given product id. After that, I check the carts but I can't find a way to remove and update the totals etc.
Hi Berkay,
This is a practically possible use case. Thanks for pointing out. Thoughts:
-
cart()` method is used for the current user's cart only/
-
Totals are updated automatically when you use any of the documented methods.
- You can find the index of the product in the cart first and remove it using the index.
- Maybe, we should provide a to do the re-calculations and update cart totals.
- We should also develop a solution in the package to remove unavailable products from all carts. But, it has to work in different drivers (Database, Session) as well.