LaravelShoppingcart
LaravelShoppingcart copied to clipboard
Get total item cart
How to get total items in cart?
You should read the doc man...
https://github.com/Crinsane/LaravelShoppingcart#cartcount
Cart::count();
Hey @Crinsane close this please :smile:
Cart::count()
is get total qty of total item. Use Cart::content()->count()
to get total item in carts.
Cart::count()
is get total qty of total item. UseCart::content()->count()
to get total item in carts.
This implies that Cart::count() will get the total count of all items in all instances of the cart but it does not work like so. Cart::count() only returns the total items in the last instance of the shopping cart.
If I did
Cart::add('293ad', 'Product 1', 1, 9.99); Cart::instance('test')->add('293ad', 'Product 1', 1, 9.99); Cart::instance('test1')->add('293ad', 'Product 1', 1, 9.99);
Doing Cart:count(), I should expect something like 3 but instead, I will get result for Cart::instance('test')->count() which is 1