Skip to content

Commit

Permalink
custom order adjustment template for cap
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsrung committed Nov 16, 2023
1 parent 729aaa7 commit 0477616
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- replace "[data-hook='order_details_adjustments']" -->
<% eligible_adjustments = adjustments.eligible%>
<tbody id="order-charges">
<% eligible_adjustments.group_by(&:label).each do |label, adjustments| %>
<tr class="total">
<td>
<strong><%= label %>:</strong>
</td>
<td class="total">
<span>
<%= Spree::Money.new(
adjustments.sum(&:amount),
currency: adjustments.first.order.try(:currency)
) %>

<%= " - Cap(#{number_to_currency(eligible_adjustments.promotion.first.source.promotion&.cap, unit: '')})" if eligible_adjustments.promotion.present? %>
</span>
</td>
</tr>
<% end %>
</tbody>

0 comments on commit 0477616

Please sign in to comment.