Skip to content

Conversation

@mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Nov 18, 2025

Summary

For in-memory promotion recalculation, it's important that shipping rates and their associated discounts are persisted when the underlying order is saved. This only works with the inverse_of: shipping_rates is set on ShippingRate#shipment along with the autosave: true on Shipment#shipping_rates.

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 November 18, 2025 08:11
@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 Nov 18, 2025
@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.45%. Comparing base (f54d7ff) to head (12a5ebe).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6374   +/-   ##
=======================================
  Coverage   89.45%   89.45%           
=======================================
  Files         974      974           
  Lines       20322    20322           
=======================================
  Hits        18179    18179           
  Misses       2143     2143           

☔ 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.

@mamhoff mamhoff force-pushed the add-autosave-to-shipment-shipping-rates branch from 168a66e to 59a592d Compare November 19, 2025 20:59
@mamhoff
Copy link
Contributor Author

mamhoff commented Nov 19, 2025

I've added a direct spec for shipments testing "marked_for_destruction", because on direct associations that is one of the few ways in which it actually changes behavior.

I've also added autosave: true to shipping rate taxes, because I'm sure that - just like shipping rate discounts - we want them to be changeable in-memory, without DB interaction.

@kennyadsl
Copy link
Member

Good to merge for me!

For in-memory promotion recalculation, it's important that shipping
rates and their associated discounts are persisted when the underlying
order is `save`d. This only works with the `inverse_of: shipping_rates`
is set on `ShippingRate#shipment` along with the `autosave: true` on
`Shipment#shipping_rates`.
Shipping Rate taxes are something we want to be able to modify in the
order updater without having to update the order graph one by one.
@mamhoff mamhoff force-pushed the add-autosave-to-shipment-shipping-rates branch from 59a592d to 12a5ebe Compare November 20, 2025 21:14
@tvdeyen tvdeyen added this to the 4.7 milestone Nov 22, 2025
@tvdeyen tvdeyen merged commit fc3adf7 into solidusio:main Nov 22, 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.

4 participants