-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Cart with soft-deletion #5361
Cart with soft-deletion #5361
Conversation
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.
This is very good!! 👏
2938c9b
to
8b0ef5f
Compare
…istributed_by scope
8b0ef5f
to
6afda87
Compare
Rebased 👍 |
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.
Awesome 👌
includes(:default_price, :stock_items, :product). | ||
index_by(&:id) | ||
end | ||
end | ||
|
||
def remove_deleted_variant(variant) | ||
line_item_for_variant(variant).andand.destroy |
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.
I think in the long term we should soft-delete the line item upon soft-deletion of the variant, ala ON DELETE CASCADE only that it'll be an UPDATE
statement in this case.
Awesome @Matt-Yorkley , Checked two scenarios here: User: Loads /shopfront (variant x is visible) I think this is the main aim of this PR, this is ready to go. The other scenario I checked is: User: Loads /shopfront (variant x is visible) While this could be improved it surely introduces a huge improvement. Should I open a separate issue for the second test-case? |
What? Why?
Closes #5358
Adds various missing specs for variant soft-deletion issues and adjusts
CartService
logic so that if a variant is soft-deleted whilst it's in an active cart or is added to a cart, the user gets useful feedback (and no fatal error problems), the item is removed and acts as if it has gone out of stock.What should we test?
Load a shop page, then delete a variant that's already shown on the page, then add that variant to the cart. It should show an out-of-stock modal and remove it from the cart.
Release notes
Fixed issues around adding deleted variants to cart.