diff --git a/app/helpers/checkout_helper.rb b/app/helpers/checkout_helper.rb new file mode 100644 index 0000000000..b21855bf7a --- /dev/null +++ b/app/helpers/checkout_helper.rb @@ -0,0 +1,13 @@ +module CheckoutHelper + def checkout_adjustments_for_summary(order) + adjustments = order.adjustments.eligible + + adjustments.reject! { |a| a.originator_type == 'Spree::TaxRate' && a.amount == 0 } + + enterprise_fee_adjustments = adjustments.select { |a| a.originator_type == 'EnterpriseFee' } + adjustments.reject! { |a| a.originator_type == 'EnterpriseFee' } + adjustments << Spree::Adjustment.new(label: 'Distribution', amount: enterprise_fee_adjustments.sum(&:amount)) + + adjustments + end +end diff --git a/app/views/spree/checkout/_summary.html.erb b/app/views/spree/checkout/_summary.html.erb new file mode 100644 index 0000000000..125254177e --- /dev/null +++ b/app/views/spree/checkout/_summary.html.erb @@ -0,0 +1,36 @@ + +
| <%= t(:item_total) %>: | +<%= order.display_item_total %> | +
| <%= adjustment.label %>: | +<%= adjustment.display_amount.to_html %> | +
| <%= t(:order_total) %>: | +<%= @order.display_total.to_html %> | +
| <%= label %> | +<%= total %> | +