The Default workflow does not have a "Finalize" transition.

Created on 28 October 2020, over 3 years ago
Updated 5 March 2024, 4 months ago

Problem/Motivation

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.

Steps to reproduce

Create a custom shipment workflow that does not have a Finalize transition. Create or Edit a shipping method and select that workflow, submit.

Proposed resolution

Remove the relevant validation from the base shipping method plugin.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡΅πŸ‡ͺPeru krystalcode

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024