Problem/Motivation

When editing a shipment, if you have the shipping method visible on the form display, it will collect rates on the shipment per method conditions, and the rate might not be the same rate as the day the order was placed.

Submitting the form will set the shipment amount to the selected rate, subsequently changing the order total, etc. This also causes requests and responses to be sent every time the shipment form is opened if the method is set on the form display, which is not ideal.

per @rszama

There are certainly reasons you might want to edit a shipment but not change the charged rate. Calculating rates from the edit form should be a manually activated thing.

On the backend, I should be able to set the method to any legitimate method for the shipment and set the price to anything I want, including $0, and only fill in the value for that rate via manual activation.

When I edit, the assumption should be that the previously selected method and rate should not change, and I should be allowed to keep the selected method even if conditions would no longer support its selection.

Steps to reproduce

Not needed.

Proposed resolution

Per @rszama's suggestion, have an optional rate that can be set on the form.

I suggest making shipping methods optional altogether, as admin orders probably don't need to use that interface. Whatever label-generating interface they are using is going to create different rates anyhow.

Maybe this is as easy as:

  • Add a new shipping method widget, or add a setting to the existing shipping rate widget to just show the recalculate shipping button until someone clicks it. That way no conditions are run, no requests are sent, and responses are received unless that is wanted.
  • Exposing the amount or original_amount field by setting ->setDisplayConfigurable('form', TRUE)

Of course, users could hide the method from the form display, but that's not ideal if they want to use it occasionally.

Remaining tasks

Hash it out and do it. 🤓

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Comments

tonytheferg created an issue. See original summary.

tonytheferg’s picture

Issue summary: View changes
tonytheferg’s picture

Adding https://www.drupal.org/node/3025096 as a parent, so this could be addressed maybe after that.