Persist line item action quantity when updated#6443
Open
AlistairNorman wants to merge 1 commit intosolidusio:mainfrom
Open
Persist line item action quantity when updated#6443AlistairNorman wants to merge 1 commit intosolidusio:mainfrom
AlistairNorman wants to merge 1 commit intosolidusio:mainfrom
Conversation
481d0ba to
de2b4bf
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6443 +/- ##
=======================================
Coverage 89.66% 89.67%
=======================================
Files 990 990
Lines 20792 20797 +5
=======================================
+ Hits 18644 18649 +5
Misses 2148 2148 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
I see I have some failures, back to draft while I sort that out. |
de2b4bf to
9183b22
Compare
jarednorman
reviewed
Apr 20, 2026
Member
jarednorman
left a comment
There was a problem hiding this comment.
Looks reasonable, but I'll re-review once you've sorted out the issues.
Contributor
Author
|
I did sort out the issues! That's why I marked it was ready! |
New records are always persisted when their parent record that they belong to is persisted so the quantity is persisted properly on the first save. The amount is always persisted because the compute_amount method returns the correct value but the quantity is set as a side effect of compute_amount and then is not explicitly persisted. In order to fix this and fix the quantity calculations on each line item we need the quantity to be set on the line item action associated with the line item in memory and then that needs to be explicitly persisted.
26860c3 to
3889424
Compare
jarednorman
approved these changes
Apr 21, 2026
Member
jarednorman
left a comment
There was a problem hiding this comment.
There's something about the way you wrote that commit message that makes me 100% sure it wasn't written by AI, which I love. (I love that it wasn't LLM-generated and I love that you write with a style that looks human.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
There's a test failure in Solidus Starter Frontend that pointed toward an actual issue in the legacy promotion system. We are not persisting quantity changes in some cases. It seems that if the order is recalculated then the issue is resolved but when the quantity is adjusted or when new items are added to the cart then the quantity on the line_item_action is not persisted which further causes issues in figuring out the used quantity in the CreateQuantityAdjustments action.
The fix requires us to find the line item action based off of the line item in memory so that it can be properly referenced later and to add a line to persist the line item actions when that is the adjustable.
The failing test in Solidus Starter Frontend is spec/system/quantity_promotions_spec.rb:68 which can be seen failing in recent actions runs such as https://github.com/solidusio/solidus_starter_frontend/actions/runs/24611089582/job/71965516590?pr=438
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: