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
Laravel Cart

Laravel Cart Laravel Package

offline-agency/laravel-cart

A Laravel shopping cart package for adding products, updating quantities, calculating totals, and managing cart data through a simple, framework-friendly API. Designed to integrate cleanly into Laravel applications.

View on GitHub
Deep Wiki
Context7

A simple cart implementation for Laravel with fiscal support.

Frequently asked questions about Laravel Cart
How do I install offline-agency/laravel-cart in a Laravel application?
Install it with Composer using composer require offline-agency/laravel-cart, then let Laravel package discovery register the service provider. The package follows Laravel conventions for configuration and service resolution, so you can publish its config if you need to adjust storage or defaults. Because it is a native Laravel package, there is no sidecar, polyfill, or extra infrastructure to wire up.
Which Laravel and PHP versions does laravel-cart 4.x support?
Release 4.1.0 sits on the 4.x line and resolves under a ^4.0 Composer constraint without editing your manifest, so the upgrade is typically just a lockfile diff and a deploy. The package is native Laravel and PHP with no added runtime dependency. Check the package's composer.json and README for the exact supported Laravel and PHP matrix before scheduling, and confirm it matches your target runtime.
What cart operations does offline-agency/laravel-cart support?
The package provides simple cart operations to add, update, remove, and clear items using familiar Laravel syntax. It also calculates line totals, item counts, and cart subtotals, so you can build straightforward checkout flows without extra computation. The API is intentionally lightweight, aimed at e-commerce surfaces that do not need a heavy cart dependency.
Does laravel-cart store cart data in the session or the database?
Cart data is kept in the session by default, which suits typical guest and single-session carts. The storage layer is flexible and can be adapted for longer-lived carts if you need persistence beyond a session. There is no implied database schema change just to use the package, so a session-based rollout is the lightest path.
Are cart mutations atomic in laravel-cart 4.1.0?
Yes. Release 4.1.0 wraps cart writes in a transactional boundary, so a multi-step mutation such as adding an item, adjusting quantity, applying a discount, and removing a line either lands fully or rolls back entirely. This closes a class of partial-write bugs that previously had to be defended against in application code. Be aware that it changes the error path: failures now roll back and surface as exceptions instead of half-succeeding silently, so audit callers that do not catch exceptions.
How does guest cart transfer to a logged-in user work in laravel-cart?
Moving a guest cart to an authenticated user is explicit and opt-in in 4.1.0, so existing installations keep their current semantics until you deliberately enable it. Confirm whether it is enabled via config, a method flag, or both, and whether it can be turned on per route. Also decide the merge policy for overlapping SKUs, since a guest and user cart containing the same product must resolve as sum, replace, or max intentionally for your catalogue.
Will upgrading to offline-agency/laravel-cart 4.1.0 break my existing cart code?
It is a minor bump, so it should resolve under a ^4.0 constraint without touching composer.json. The main behavioural change is on the error path: with atomic mutations, operations that previously half-succeeded now roll back and throw, which means failures can propagate to your controllers. Update your test plan to cover rollback and exception handling, and check whether event listeners dispatched inside a mutation now run inside or outside the transaction boundary.
Do I need to run a database migration to use laravel-cart?
No data migration is implied by the 4.1.0 atomicity change, because that change is behavioural rather than structural. However, confirm whether the guest transfer feature stores any merge bookkeeping that introduces a publishable migration. If it does, that is the one item that could turn a config-only rollout into a deploy-window task.
How do I test offline-agency/laravel-cart in a Laravel application?
Because the default storage is session-based, you can use Laravel's standard testing helpers to assert cart contents, quantities, and totals after each operation. Cover the new failure paths too: verify that a mutation which throws rolls back completely rather than leaving partial items. If you enable guest transfer, add tests for overlapping SKUs so the merge policy behaves as intended.
Is offline-agency/laravel-cart a good alternative to heavier Laravel cart packages?
It is a good fit when you want reliable add, update, remove, and clear operations plus totals and item counts with minimal setup and no heavy dependency. It suits straightforward e-commerce and checkout flows rather than catalogues that need advanced promotions, complex pricing rules, or multi-warehouse logic. If your requirements are simple and you want a framework-friendly API, it is a low-friction option; if you need richer commerce features, a heavier package may be warranted.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console