Update orders

You need to use the recalculate method on a Spree::Order to keep its total up-to-date. Note that the total changes every time that line items and adjustments are added or modified. The recalculate method calls out to the Spree::OrderUpdater class .

For example, the solidus_backend gem's Spree::Admin::AdjustmentsController uses the recalculate method to update totals throughout the lifetime of an order:

      def update_totals


The update_totals method is called every time that adjustments are created, destroyed, and updated.

Whenever you change the code that touches the values of a Spree::Order, use the recalculate method to ensure your order's totals are accurate. For example, you would want to call the recalculate method in the following scenarios:

  • Whenever you create or modify a Spree::Payment that changes the order's payment_state value.
  • Whenever a Spree:LineItem on the order has a price change.


Solidus is an open source platform supported by the community. We encourage everyone using Solius to contribute back to the documentation and the code.

If you’re interested in contributing to the docs, get started with the contributing guidelines. If you see something that needs fixing and can’t do it yourself, please send us an email.