← Graph

Should 'add item' be split into add-new and increase-existing?

question 2 connections

Audience suggestion that since whether adding a product creates a new cart item or increases an existing one differs by business (B2B, build-to-order, custom printing), 'add item' should expose two distinct methods. Rafael's answer: internally Spree's service object already has both private paths, just one public entry point. A cleaner solution (analogous to Spree's guest-cart-to-user merge-vs-replace strategies) is to ship two implementations as the default service objects and let users pick via dependency injection configuration — or call the other service object directly if they don't use the standard endpoint.

answer_summary
Internally the two branches already exist. A better answer is to ship two DI-configurable strategies so users pick the behavior that fits their business.
question Should 'add item' be split into add-new and increase-existing?
about
Answer proposes shipping two DI-configurable strategies.
question Should 'add item' be split into add-new and increase-existing?
asked_at
Audience question during Q&A.

Provenance

Read by
2 extractions