Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove specific product in all users carts #17

Open
berkayk opened this issue Dec 23, 2019 · 1 comment
Open

Remove specific product in all users carts #17

berkayk opened this issue Dec 23, 2019 · 1 comment

Comments

@berkayk
Copy link

berkayk commented Dec 23, 2019

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.

@gauravmak
Copy link
Member

Hi Berkay,

This is a practically possible use case. Thanks for pointing out. Thoughts:

  1. cart()` method is used for the current user's cart only/

  2. 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.
  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants