- What is vanilo/cart and what problem does it solve?
- vanilo/cart is the cart module of the Vanilo e-commerce framework for Laravel. It provides cart and cart item models, quantity handling, price resolution, and an adjustment engine for promotions, taxes, and shipping allocations. It is a domain module designed to compose with other Vanilo packages rather than a standalone cart library.
- How do I install vanilo/cart in a Laravel application?
- Install it with Composer using composer require vanilo/cart. Register the module service provider through Concord auto-discovery or explicit registration, then publish and run the package migrations. Finally bind the cart contracts to Vanilo's default implementations or your own implementations.
- Which Laravel and PHP versions does vanilo/cart support?
- Support depends on the Vanilo release line you install. The package assumes PHP 8.x and Laravel 9, 10, or 11 depending on whether you are on Vanilo 3, 4, or 5. Pin your Vanilo versions and run upgrade tests because contracts and namespaces have changed across major lines.
- Can I use vanilo/cart without adopting the full Vanilo framework?
- Technically yes, but the value proposition degrades quickly. The cart assumes Vanilo's product, pricing, and checkout abstractions for item resolution, the adjuster pipeline, and order handoff. In a non-Vanilo Laravel app, expect to retrofit contracts or replace significant parts of the integration.
- How does vanilo/cart handle taxes, promotions, and shipping?
- It uses an ordered adjuster pipeline applied to the cart and its items. Promotions, tax calculations, and shipping allocations plug in as adjusters at defined positions. You can adopt Vanilo's default adjuster set or write and order your own adjusters.
- Should I use session or database storage for Vanilo carts?
- Both are supported, but database-backed cart persistence is the favored convention in Vanilo. Session storage can work for simple flows, while database storage suits multiple carts, logged-in users, and checkout recovery. Choose based on your concurrency, retention, and reporting needs.
- Can one user have multiple carts with vanilo/cart?
- Yes, the package supports multiple cart instances. That is useful for saved carts, wishlists, or separate storefront contexts. You manage instance selection through the cart contracts and your application's resolution logic.
- How do I convert a Vanilo cart into an order at checkout?
- Order conversion lives outside vanilo/cart in the vanilo/order and vanilo/checkout packages. The cart module provides the cart state and adjustments, but you must satisfy the checkout-to-order contract from those packages. Plan for additional Vanilo modules in scope if you need a complete checkout flow.
- How do I test a Laravel app that uses vanilo/cart?
- Use Laravel's testing tools with an in-memory SQLite database and the package migrations. Bind the cart contracts to real or fake implementations, then assert quantities, prices, and adjustment outcomes. Focus test coverage on your custom adjusters and item/product resolution, because those are the integration points most likely to break.
- Is vanilo/cart actively maintained, and what are the alternatives?
- The package has a small public footprint and a single-primary-maintainer risk profile typical of the Konekt/Vanilo family, so pin versions and plan upgrade testing. Alternatives include darryldecode/cart and gloudemans/shoppingcart, which are standalone Laravel cart libraries but lack Vanilo's adjuster and contract model. If you leave Vanilo, budget for custom adjustments or a fork.