Allow canceling a completed order (Workflows)

Created on 16 August 2023, about 1 year ago

Problem/Motivation

Orders can't be canceled, once they are completed. But sometimes (real world) it happens that a completed order still needs its status to be changed to "Canceled", for example if the item can't be delivered or whatever happens.

So "Canceled" should be always available for shop owners to decide, also on completed orders. If we need additional complexity, it could become a setting, but I don't think that's needed. "Canceled" is just a special case of transition that should be allowed from anywhere.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Closed: duplicate

Version

2.0

Component

Order

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

  • Issue created by @Anybody
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    We should say it the other way around:

    We shouldn't disallow to cancel a completed order!
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    774 pass, 4 fail
  • @anybody opened merge request.
  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇮🇱Israel jsacksick

    Why don't you define your own workflow?

  • 🇩🇪Germany Anybody Porta Westfalica

    Of course, I can do that and also thought about it, but I created the issue as I think it might be worth discussing, if this isn't kind of wrong currently and would also be helpful for other Drupal Commerce users.

  • Status changed to Closed: duplicate about 1 year ago
  • 🇳🇴Norway zaporylie

    From my personal point of view, the introduction of the completed => cancel transition would open the Pandora box of bugs.

    The reason for that is that currently Completed is defined as the final state of the state machine. The proposed change would change the definition of such a state to non-final while some operations done toward final states can't be reverted.

    I am closing this issue as a duplicate as per 💬 Impossible to cancel an order Fixed and recommend going there in case the discussion should be reopened.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks for the feedback @zaporylie I totally understand that point from the technical point. Still from the user / shop owner perspective I think differently, so perhaps the correct solution would be to have a different ending state like "annulled" (sorry I had to find a different matching word, might not be the right one in English). That wouldn't allow further transitions out.

    Still it's the real world, I think...

  • 🇳🇴Norway zaporylie

    I am also basing it on a real-world example :) We can't allow our merchants to cancel something that has already been declared completed. To us, it is because it means:
    - payment was already captured (can't be canceled)
    - consignment was created and the courier is on their way
    - invoice/receipt was issued and it is an accounting document that cannot be deleted or modified.

    Having a new state added after "completed" would make it impossible to revert any of these actions but we would give the merchant a false hope that they can. And the limitation here would be the law - one would argue that's a real-world thing... I dunno ;)

  • 🇩🇪Germany Anybody Porta Westfalica

    Haha thank you @zaporylie - nice discussion ;) There's a workaround in #5 so I'm fine with this.

    From my perspective, there are good reasons from both sides, but you may see it differently. We can also wait for the third, fourth, ... issue to be opened on this topic, perhaps that someone agrees that "Complete" isn't the only "End". Until that let's be happy with what we have.

    Thank you.

  • 🇳🇴Norway zaporylie

    I do believe there's a place for that "feature" as Drupal/Commerce is used and abused to satisfy many different scenarios, not only for developing straightforward and law-compliant e-commerce projects ;) However, the risk of introducing regression is not worth pursuing the path of altering existing workflows. I believe this could be a nice addition though, either added in contrib or order workflows extended with new workflows directly in the commerce codebase (however I'd prefer contrib tbh).

Production build 0.71.5 2024