Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order checkout flow completion with custom steps #3950

Conversation

nerfologist
Copy link
Contributor

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

Description:

The Spree::Order checkout flow is configurable and steps (states) can be added or removed. Unfortunately, removing the confirm state was causing issue #3926 since the code for the complete event was still taking for granted that the confirm state was part of the flow.

This PR fixes the problem by plugging in the last step of the configurable checkout flow instead.

Also, a paragraph explaining how to customize the checkout flow has been added to the Order documentation, since the feature is available in the codebase.

Fixes #3926.

The Spree::Order model has a configurable checkout flow where steps can
be customised. One of the configurable steps is 'confirm'. As a result,
the 'confirm' step is optional.

The code defining the transition for the 'complete' event was still only
transitioning from the 'confirm' state, rather than from the last
configured checkout flow state. This was causing a problem in case the
'confirm' step was actually missing.

This commit removes the hardwired 'confirm' state reference and obtains
the last configured flow state instead.
@nerfologist nerfologist changed the title Fix order checkout flow with custom steps Fix order checkout flow completion with custom steps Feb 21, 2021
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, and thanks for adding the Guide section about it.

@kennyadsl kennyadsl added this to the 3.1.0 milestone Mar 6, 2021
@kennyadsl kennyadsl added release:major Breaking change on hold until next major release changelog:solidus_core Changes to the solidus_core gem labels Mar 6, 2021
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 👍

@kennyadsl kennyadsl merged commit 5cbffae into solidusio:master Apr 30, 2021
@kennyadsl kennyadsl added Important Change and removed release:major Breaking change on hold until next major release labels Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing confirm checkout step doesn't allow transition to complete
4 participants