Skip to content
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

Move shipping promotion handling to legacy promotions #5753

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented May 16, 2024

Summary

We should only provide configuration points that are actually necessary for a promotion system. The shipping promotion handler is not necessary for a promotion system that works, thus we can move this stuff to the legacy_promotions extension.

Extracted from #5634

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.

With a properly configured promotion system, we don't need a special
"shipping" promotion handler. This moves the shipping-specific
promotion handling into the solidus_legacy_promotions gem.
The new promotion system does not distinguish between shipping
promotions and other promotions, and there is no need for a dedicated
shipping promotion handler class in the public API for the promotion
configuration.

Deprecate it.
@mamhoff mamhoff requested a review from a team as a code owner May 16, 2024 14:32
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:repository Changes to the repository not within any gem labels May 16, 2024
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.85%. Comparing base (1fdedd4) to head (4a91b73).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5753   +/-   ##
=======================================
  Coverage   88.85%   88.85%           
=======================================
  Files         706      707    +1     
  Lines       16781    16789    +8     
=======================================
+ Hits        14910    14918    +8     
  Misses       1871     1871           

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

def self.prepended(base)
base.state_machine do
if states[:delivery]
before_transition from: :delivery, do: :apply_shipping_promotions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be formally breaking if someone replaced their whole state machine and removed this transition. But, I think it's acceptable because if that store doesn't use shipping promotions there won't be any change, and if they use it, it will just be recalculated twice.

@kennyadsl kennyadsl merged commit 098260d into solidusio:main May 21, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:repository Changes to the repository not within any gem changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants