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

Add method to cart instance to get count based on item quantity #15

Open
bezin opened this issue Jul 10, 2020 · 0 comments
Open

Add method to cart instance to get count based on item quantity #15

bezin opened this issue Jul 10, 2020 · 0 comments

Comments

@bezin
Copy link

bezin commented Jul 10, 2020

Hello,

it would be nice to add a new method to the cart object to get the total number of items based on quantity, eg.

// Cart contains two items A and B, A with quantity 1, B with quantity 3

cart()->count() // Returns 2, because 2 items
cart()->countQuantity() // Return 4, because 1 A and 3 B

One could use this method to display the total number of items in cart in the page header.
Might be better added to ProductList rather than cart.

Cheerio

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

No branches or pull requests

1 participant