Currently we have the Adjustment value object. It can be of a type, but what that type is... well nothing defines this.
Without knowing what "type" of adjustments are available we cannot properly display them in a form interface. For example, if we add a "tax" or "shipping" adjustment programmatically, it will not be displayed properly in the current field widget.
Widget: https://github.com/drupalcommerce/commerce/blob/8.x-2.x/modules/order/sr...
The types would allow us to properly populate the dropdown for adding and editing the type of adjustments.
This also allows for the adjustment type to provide its own form for the widget. The default AdjustmentType would provide a PluginForm for collecting the label and amount.
It turns out simple way to adjust an order via an API into a more usable form interface.
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commented+1
Comment #3
mglamanComment #4
steveoliver CreditAttribution: steveoliver at Circatree commented@mglaman, do you have any progress on this to post, or should I start something?
Comment #5
mglamanI got nowhere. I went too deep worrying about plugin forms and what not. We should at least get the basic AdjustmentType plugin in to act like pseudo bundles for the adjustment objects.
I figure we should at least get something basic to say "The dropdown of adjustment types is THIS" maybe a flag to say "reset on order refresh" (like custom would be FALSE, sales_tax / shipping TRUE) and "has ui" (so it shows in form but not editable.
Comment #6
steveoliver CreditAttribution: steveoliver at Circatree commentedSee https://github.com/drupalcommerce/commerce/pull/592
Comment #7
steveoliver CreditAttribution: steveoliver at Circatree commented@mglaman: I get the has_ui bit, but what would "maybe a flag to say "reset on order refresh"" actually do?
Comment #8
bojanz CreditAttribution: bojanz at Centarro commentedI'm not sure we need the flag. We need the ability to lock adjustments instead, so that any adjustment added through the UI is not automatically removed in order refresh.
Comment #9
steveoliver CreditAttribution: steveoliver at Circatree commentedAh yes, I get what you're saying now--reset or recalculate adjustment on order refresh and bojanz you're talking about locking, which is different.. I'll be back at this next week, but let's keep discussing how adjustments need to work/lock/refresh..
Comment #11
bojanz CreditAttribution: bojanz at Centarro commentedThank you!