- What is vanilo/adjustments used for in Laravel e-commerce?
- vanilo/adjustments provides a uniform way to attach monetary adjustments such as discounts, promotions, taxes, shipping fees, and other price modifications to orders and line items. You implement the Adjustable contract on Eloquent models that carry pricing and store each delta as a polymorphic Adjustment record. It is a domain module in the Vanilo e-commerce suite and is often consumed transitively through vanilo/order or vanilo/cart.
- How do I install and migrate vanilo/adjustments?
- Run composer require vanilo/adjustments, then publish and run the adjustments migration. The package registers a service provider and follows Concord module conventions. After migrating, implement Adjustable on the models that need price deltas and verify the polymorphic relation works.
- How do I configure the Adjustable models and Concord bindings?
- Implement the Adjustable contract and use the provided trait on each model that carries pricing, such as cart lines, order lines, orders, and shipments. Register any interface bindings required by your Concord configuration. The only non-obvious convention is Concord's module registration, which is familiar to teams already running Vanilo modules.
- Which Laravel and PHP versions does vanilo/adjustments support?
- The evaluation context lists Laravel 9-11 and PHP 8.1+ with MySQL or Postgres and standard Eloquent. Support is tied to the wider Vanilo suite and Concord module loader, so check the release matrix before upgrading. Pin exact versions across the suite and test major upgrades in staging.
- How should I test adjustments in a Laravel application?
- Test by creating adjustments on an adjustable model and asserting the polymorphic relation and typed collection behavior. Add reconciliation tests that compare the sum of adjustments against expected order totals. Cover rounding edge cases and correction patterns, and run these tests against the exact Laravel and Concord versions you deploy.
- Can I extend adjustment types without forking the package?
- Adjustments carry a type and description, and the design is intended to be extensible. Depending on the release, custom types may be added through an enum, configuration, or class map. Confirm the supported extension mechanism for your pinned version before building a taxonomy around it.
- How should rounding and currency be handled for adjustments?
- The package records monetary deltas, but your application must decide the rounding policy. Agree whether rounding applies per adjustment, per line, or at order level before data accumulates. Currency handling should be consistent with your order total calculator, and you should reconcile sums against expected totals.
- What are the production risks of using vanilo/adjustments?
- The main production risks are version lockstep with Concord and Laravel majors, a small maintainer group, and sparse public issue history. Mitigate by pinning exact versions, wrapping the package behind a thin internal service, and keeping the migration reversible. Do not assume the adjustments table is an immutable audit ledger unless you design it that way; use correction entries for mis-applied discounts.
- What are the alternatives to vanilo/adjustments?
- Inside Vanilo, the natural alternative is to use the adjustment features already available through vanilo/order or vanilo/cart. Outside Vanilo, a bespoke adjustments table can be lower friction unless you are willing to adopt Concord's service-provider and binding patterns. The package's value compounds when used with the wider Vanilo suite.
- How is vanilo/adjustments maintained and versioned?
- The package is MIT-licensed and is almost always consumed transitively through Vanilo rather than chosen on its own. Its health is coupled to the parent suite's release cadence and a small maintainer group. Pin exact versions, track Vanilo releases, and keep upgrade paths tested.