workarea-commerce / workarea

Workarea is an enterprise-grade Ruby on Rails commerce platform
https://www.workarea.com
Other
327 stars 66 forks source link

Configurable Order Item Equivalence Attributes #474

Closed tubbo closed 4 years ago

tubbo commented 4 years ago

When adding an item that already exists in the cart, Workarea previously checked the SKU and customizations on the item before deciding whether to actually build a new Order::Item or update the one found in place. This is somewhat limiting for plugins such as Workarea::Subscriptions, which add more data to an order item that is expected to be updated in place (so long as the item is a subscription). To address this, a configuration setting has been added which plugins and apps can append to in order to affect the "uniqueness" of a particular order item. By appending to this config, both host apps and plugins can tell the Order::ItemsExtension#find_existing method to factor in additional fields on the order when determining whether a given item exists in the cart or not.

tubbo commented 4 years ago

@mttdffy I'm down for that, the ItemsExtension thing has always bugged me. I remember having to/wanting to decorate that in the past and finding it quite impossible.