Skip to content
This repository was archived by the owner on Sep 4, 2018. It is now read-only.
This repository was archived by the owner on Sep 4, 2018. It is now read-only.

Provide guidance on designing a custom order or line_item adjustment type #215

@dpritchett

Description

@dpritchett

This is sort of a companion request to spree/spree#4483

Sample use case

I'm looking at implementing a warranty upsell to specific products in my store. I've built out a simple ProductType model that has_many :product_addons, and now Products have_many addons through :product_types. I've done something very similar before under Spree 2.0 but I'm pretty sure my implementation could be improved. Now that the 2.2 adjustments refactor is out I'm faced with making a few guesses about a solid implementation. I'm sure I'll make it work, but this seems like a good case for a custom adjustments guide.

Possible guide content

  • The adjustment calculator API - which methods to implement? Should I subclass an existing calculator?
  • A sample custom adjustment overview - all of the classes, tables, etc. required to pull it off on the backend. In practice I need admin CRUD screens to manage my custom adjustment options and I need to adjust the _cart_form template to add the adjustments to the frontend, but that is not exactly central to the guide I'm proposing here.
  • Recommendations on extending the OrderPopulator/OrderUpdater - how and where would you safely add extra data to the cart? I pulled this off under 2.0 but again I imagine it could've been done better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions