commerce-order-total-summary.html.twig 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {#
  2. /**
  3. * @file
  4. * Default order total summary template.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the wrapper.
  8. * - order_entity: The order entity.
  9. * - totals: An array of order totals values with the following keys:
  10. * - subtotal: The order subtotal price.
  11. * - adjustments: The adjustments:
  12. * - type: The adjustment type.
  13. * - label: The adjustment label.
  14. * - amount: The adjustment amount.
  15. * - percentage: The decimal adjustment percentage, when available. For example, "0.2" for a 20% adjustment.
  16. * - total: The order total price.
  17. *
  18. * @ingroup themeable
  19. */
  20. #}
  21. {{ attach_library('commerce_order/total_summary') }}
  22. <div{{ attributes }}>
  23. {% if totals.subtotal %}
  24. <div class="order-total-line order-total-line__subtotal">
  25. <span class="order-total-line-label">{{ 'Subtotal'|t }} </span><span class="order-total-line-value">{{ totals.subtotal|commerce_price_format }}</span>
  26. </div>
  27. {% endif %}
  28. {% for adjustment in totals.adjustments %}
  29. <div class="order-total-line order-total-line__adjustment order-total-line__adjustment--{{ adjustment.type|clean_class }}">
  30. <span class="order-total-line-label">{{ adjustment.label|t }} </span><span class="order-total-line-value">{{ adjustment.amount|commerce_price_format }}</span>
  31. </div>
  32. {% endfor %}
  33. {% if totals.total %}
  34. <div class="order-total-line order-total-line__total">
  35. <span class="order-total-line-label">{{ 'Total'|t }} </span><span class="order-total-line-value">{{ totals.total|commerce_price_format }}</span>
  36. </div>
  37. {% endif %}
  38. </div>