I'm unclear on what the 'fulfillment' order state represents.

To be specific, I'm writing code for Commerce License to make a license entity active when the order reaches a certain state. For the order_default workflow, that's simple: the 'completed' state is the point at which this should happen.

But I am confused about the workflows that have a 'fulfillment' state, such as the 'order_fulfillment' workflow. If the order uses this workflow, would it be more correct to grant the license in the 'fulfillment' state? However, this means the event subscriber needs to react to 2 different state changes, which is much less clean code. Given that, I'm unsure that other things a developer might happen when this state is reached.

Perhaps some comments could be added in the workflows.yml file to explain this?

Comments

joachim created an issue. See original summary.

bojanz’s picture

 If the order uses this workflow, would it be more correct to grant the license in the 'fulfillment' state?

Yes, licenses should be granted in the "fulfillment" state, that's crucial.
If a license is remote, provisioning might fail, so the order needs to stay in "fulfillment" until that is fixed.
That's the reason why digital orders need that state.
(For physical orders it's more straightforward, the order stays in fulfillment until all shipments are sent).

Thus, License should require people to use a fulfillment workflow just like shipping does.

Suggestions welcome on what comments would help.

joachim’s picture

Category: Support request » Feature request

> Thus, License should require people to use a fulfillment workflow just like shipping does.

I see from the README for Commerce Shipping that this is something site builders have to set up manually:

3. Edit your order type:
  - Select one of the fulfilment workflows.
  - Enable shipping and choose a shipment type.
  - Select the 'Shipping' checkout flow

Would it not be cleaner to allow product types to force the workflow they need? Otherwise, it would be possible for a site builder to neglect to read the instructions, and then orders would get created without the right workflow.

(Also, side note probably for another issue: what happens if different products require different, incompatible workflows on order?)

bojanz’s picture

(Also, side note probably for another issue: what happens if different products require different, incompatible workflows on order?)

That's not really our problem (nothing we can do about it).
The person who's setting up the order type can create a custom workflow that includes states from both conflicting workflows, solving it that way.

bojanz’s picture

Category: Feature request » Support request
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.