Fix return item initialization in backend - #6411
Merged
mamhoff merged 2 commits intoFeb 2, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6411 +/- ##
=======================================
Coverage 89.50% 89.50%
=======================================
Files 981 981
Lines 20479 20479
=======================================
+ Hits 18329 18330 +1
+ Misses 2150 2149 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jarednorman
approved these changes
Jan 29, 2026
tvdeyen
approved these changes
Jan 30, 2026
tvdeyen
left a comment
Member
There was a problem hiding this comment.
Worth a backport to 4.6 right?
This fixes an issue with the `display_` money methods which require the instance to define a public method for `#currency`. It seems like this has been broken for a while, which meant the currency for `ReturnItem`s would always use the store default configured currency. Co-authored-by: Alistair Norman <alistair@super.gd>
This change ensures that return items built for a new return authorization are correctly associated with it. This will ensure that the display_* methods use the currency from the return authorization, instead of the default store currency. Co-authored-by: Alistair Norman <alistair@super.gd>
tvdeyen
force-pushed
the
fix-return-item-initialization
branch
from
January 30, 2026 09:17
f9581d5 to
a570cc0
Compare
mamhoff
approved these changes
Feb 2, 2026
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
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
This change resolves two separate issues on multi-currency stores where return items
display_*methods would not correctly get the currency and fallback to the store configured currency.By making
ReturnItem#currencypublic we resolved an issue with how theDisplayMoneyconcern test if the class it's included in defines thecurrencymethod. The current code usesrespond_to?which only checks for public methods. We didn't change that behaviour but we could also use the extended form and check all visibility levels if that is preferred (i.e.respond_to?(:currency, true).By associating non-persisted return items with the return authorization they are built for we can ensure that the
display_*methods correctly get the currency from the return authorization (which delegates that to the order). In the previous implemetation that used the fallback defined in ReturnItem#currency and always used the store defaults.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: