-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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#restart_checkout_flow
for empty orders
#5330
Fix Order#restart_checkout_flow
for empty orders
#5330
Conversation
We are resetting the order flow after emptying an order to get the "cart" state back. However, there's an upstream bug where an error is added in that scenario. See solidusio/solidus#5330 [skip ci]
We are resetting the order flow after emptying an order to get the "cart" state back. However, there's an upstream bug where an error is added in that scenario. See solidusio/solidus#5330 [skip ci]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waiting-for-dev thanks for the fix, looks good to me, and I left a suggestion for the spec, please let me know if it works for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
solidusio#4369 introduced a regression where when calling `Spree::Order#restart_checkout_flow` on an empty order, an error would be added to the order. That happened when calling `#next` and the validation failed because no line items were present. We restore the previous behavior where we only try going to the `"address"` state if the order has line items.
7bea6bd
to
82c7bdf
Compare
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
We are resetting the order flow after emptying an order to get the "cart" state back. However, there's an upstream bug where an error is added in that scenario. See solidusio/solidus#5330 [skip ci]
Order#restart_checkout_flow
for empty orders
Summary
#4369 introduced a regression where when calling
Spree::Order#restart_checkout_flow
on an empty order, an error would be added to the order. That happened when calling#next
and the validation failed because no line items were present.We restore the previous behavior where we only try going to the
"address"
state if the order has line items.Context: That regression was a problem on the GraphQL extension, as
#restart_checkout_flow
was called to bring the order back to thecart
state. It was confusing in case of a user requesting theerrors
node. See https://github.com/solidusio/solidus_graphql_api/blame/main/lib/solidus_graphql_api/mutations/checkout/empty_cart.rb#L13-L15.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: