- π¨πSwitzerland Mistrae
Thanks for the patch. We do not need the finalize transition either.
The default shipping method plugin base class enforces in its form validation that the chosen shipment workflow must have a Finalize and a Cancel transition. This is not always the case; for example, fulfillment may not happen within Drupal and shipment states are not utilized at all i.e. never transitioned, or fulfillment happens outside of Drupal and they are synced back to Drupal but they are either completed (shipped) or cancel i.e. Drupal is not concerned with the intermediate Ready state, or for whatever reason the site has a custom workflow that does not require a Finalize and/or a Cancel transition.
The validation method could be overridden in the shipping method, however the issue is that the shipping method might not be directly connected to the shipment workflow. For example, the Flat Rate plugin defines a shipping method that is only concerned with providing the price for the order's shipping adjustment; it is not concerned with what is the fulfillment process. Then another module (contrib or custom) defines the shipment workflow that is relevant to the store's fulfillment process that might not have a Finalize and or Cancel transition.
In my case I could manipulate the form validation using a hook, but I feel that's not the right way generally speaking. Why does the validation happen in the first place, is it assumed to exist somewhere else in Commerce Shipping? The shipping method should not validate the shipment workflow since, as demonstrated in the given example, they can be independent.
Create a custom shipment workflow that does not have a Finalize transition. Create or Edit a shipping method and select that workflow, submit.
Remove the relevant validation from the base shipping method plugin.
Active
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Thanks for the patch. We do not need the finalize transition either.