Skip to content

Conversation

@mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Oct 31, 2025

Summary

For the upcoming "strikethrough prices"/"promotion previews" feature, we need to allow passing options to calculator's compute methods.

For strikethrough prices, we will need the current order and the desired quantity to be passed into the calculator, and this commit allows passing any desired options.

Since calculators are polymorphic in all directions and can be used in all kinds of context, we don't specify which options are possible.

This also does the groundwork for allowing the
SolidusPromotions::Benefit to take options and pass them on to its calculator.

Because these methods are used a lot in Solidus, adds YARD-style documentation to the modified methods.

Extracted from #6287

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@mamhoff mamhoff requested a review from a team as a code owner October 31, 2025 12:37
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_promotions Changes to the solidus_promotions gem labels Oct 31, 2025
@mamhoff mamhoff force-pushed the calculator-options branch from 38a9e1d to 587348f Compare October 31, 2025 12:39
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.34%. Comparing base (2d1fcff) to head (5a885dc).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6346   +/-   ##
=======================================
  Coverage   89.34%   89.34%           
=======================================
  Files         961      961           
  Lines       20165    20165           
=======================================
  Hits        18016    18016           
  Misses       2149     2149           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

For the upcoming "strikethrough prices"/"promotion previews" feature, we
need to allow passing options to calculator's `compute` methods.

For strikethrough prices, we will need the current order and the desired
quantity to be passed into the calculator, and this commit allows
passing any desired options.

Since calculators are polymorphic in all directions and can be used in
all kinds of context, we don't specify which options are possible.

This also does the groundwork for allowing the
SolidusPromotions::Benefit to take options and pass them on to its
calculator.

Because these methods are used a lot in Solidus, adds YARD-style
documentation to the modified methods.
@mamhoff mamhoff force-pushed the calculator-options branch from 587348f to 5a885dc Compare October 31, 2025 15:51
@tvdeyen tvdeyen added this to the 4.7 milestone Nov 1, 2025
@mamhoff mamhoff merged commit c4f8799 into solidusio:main Nov 1, 2025
39 checks passed
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 changelog:solidus_promotions Changes to the solidus_promotions gem

Projects

Development

Successfully merging this pull request may close these issues.

3 participants