Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Shoppingcart

Shoppingcart Laravel Package

gloudemans/shoppingcart

Laravel Shoppingcart is a simple, flexible cart package for Laravel. It supports multiple cart instances, item attributes, conditions like discounts and VAT, and pluggable storage drivers including sessions and databases. Easily add, update, and remove items and calculate totals.

View on GitHub
Deep Wiki
Context7

Gloudemans ShoppingCart is a flexible shopping cart package for Laravel that stores cart data in the session and provides an intuitive API for adding, updating, and removing items. It supports multiple cart instances, item attributes, and conditions for discounts, taxes, or fees, with automatic subtotal, tax, and total calculations.

  • Session-based cart with multiple independent instances
  • Rich item attributes and quantity management
  • Conditions for discounts, taxes, and fees
  • Automatic totals and price formatting helpers
  • Laravel events and exceptions for cart operations
Frequently asked questions about Shoppingcart
How do I install gloudemans/shoppingcart in a Laravel app?
Install it with Composer using composer require gloudemans/shoppingcart, then register the package service provider and publish its configuration file. After that you can call the Cart facade methods such as Cart::add(), Cart::content(), and Cart::total() from your controllers. Be aware that the published constraints target older Laravel versions, so on a modern framework you may need to adjust them first.
Which Laravel and PHP versions does LaravelShoppingcart support?
The last tagged release was in February 2019, which predates Laravel 6 and the PHP 7.4 and 8.x era. On Laravel 10, 11, or 12, Composer will almost certainly reject the package because of its illuminate/* version constraints. You either pin an old framework or fork the package, relax the constraints, and validate behavior on PHP 8.2 or newer.
Does gloudemans/shoppingcart support multiple cart instances?
Yes. The package is built around the idea of multiple cart instances, so you can keep separate carts for different purposes, such as a wishlist alongside a checkout cart, without them interfering with each other. This is one of the features that made it a popular lightweight option for Laravel storefronts.
Can the cart be stored in the session or in the database?
The default storage is the Laravel session, which keeps cart state tied to the user's server-side session. The package also offers database storage for carts that need to persist beyond a session. In practice, session storage limits how well the cart scales across multiple servers unless you use a shared session driver such as Redis or the database.
How are taxes, coupons, and conditions handled?
The package supports item-level taxes, conditions, and a basic coupon-style flow, so you can apply discounts or surcharges and recalculate totals. It is a cart primitive rather than a commerce platform, meaning it does not model full pricing rules, tax engines, promotions, inventory, or multi-currency logic. Monetary values are handled as floats rather than integer minor units, which introduces rounding risk for tax and total calculations at scale.
Is gloudemans/shoppingcart still maintained?
No. There have been no releases since February 2019, so there are no security patches, no PHP 8 compatibility guarantees, and no response to Laravel lifecycle changes. The zero-dependents signal suggests it is not being pulled into new greenfield projects, which means community support is a shrinking asset. The MIT license is permissive, so forking and maintaining your own version is legally straightforward.
Is this package suitable for headless or API-first commerce?
It is a poor fit for headless, API-first, or multi-service architectures. The library assumes a traditional Laravel MVC application where the cart lives in the user's session, which tightly couples state to a single application instance and the request lifecycle. It also lacks the persistence needed for guest carts that survive across devices or for cart state that must remain authoritative on the server.
What are good alternatives to LaravelShoppingcart?
Common options include darryldecode/cart, a maintained fork of this package with updated framework constraints, or a custom cart domain model built around your own pricing and persistence needs. For anything beyond a basic cart, a dedicated commerce platform or an in-house CartService is usually a better long-term choice. Whichever you pick, keep the package behind an internal interface so it can be swapped later.
What are the main production risks of using this package?
The dominant risk is abandonment rather than design: no releases since 2019 means no security patches and no guarantees against session driver or container changes in newer Laravel versions. Session-backed storage also caps cart size and creates correctness concerns under concurrency and horizontal scaling. Float-based money math adds rounding risk for taxes and totals, so wrap the package behind an adapter and add characterization tests around totals, tax, and coupon behavior before relying on it.
Can I use this package on Laravel 10, 11, or 12?
Not directly, because Composer will almost certainly reject its illuminate/* constraints. The practical route is to fork the repository, update the constraint ranges, and test the cart behavior on PHP 8.2 or newer in a real application. The code surface to update is small, but you should budget for test coverage since the upstream project has no maintained test suite against modern PHP.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections