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
For example, the
recalculate method to update totals throughout the lifetime of an order:
def update_totals @order.reload.recalculate end
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
recalculate method to ensure your order's totals are accurate. For
example, you would want to call the
recalculate method in the following
Spree::Paymentthat changes the order's
Spree:LineItemon the order has a price change.
Solidus is an open source platform supported by the community. We encourage everyone using Solidus to contribute back to the documentation and the code.