The Spree::Order
model includes a number of useful methods for displaying
totals and balances:
display_outstanding_balance
: The outstanding balance for the order, calculated by
taking the total
and subtracting the current payment_total
.display_item_total
: The total of the line items on the order. display_adjustment_total
: The total of the adjustments on the order.display_total
: The order total.display_total_available_store_credit
: The total available store credit.display_order_total_after_store_credit
: The order total after store credit
has been applied.display_store_credit_remaining_after_capture
: The amount of store credit
remaining after an order payment has been captured.By default, the following methods return Spree::Money
objects configured with
the order's currency symbol. For example:
@order.display_total.to_html
# => "$10.99"
Because Spree::Money
objects are based on the
Ruby Money
library
, you can further change what information is displayed using
its
format
method:
@order.display_total.format(with_currency: true)
# => "$10.99 USD"
Solidus is an open source platform supported by the community. We encourage everyone using Solidus 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.