I want to Display the tax percentage rate at the order total summary. I use the "European Union VAT" plugin, so tax percentage is calculated based on Time, Place and Product-Type.

My dirty solution for now is to calculate the tax by total price an tax-ammount in custom template commerce-order-total-summary.html.twig:
{{ attach_library('commerce_order/total_summary') }}
<div{{ attributes }}>
<div class="order-total-line order-total-line__subtotal">
<span class="order-total-line-label">{{ 'Subtotal'|t }} </span><span class="order-total-line-value">{{ totals.subtotal|commerce_price_format }}</span>
</div>
{% for adjustment in totals.adjustments %}
{% set lineLabel = adjustment.type == "tax" ? "#{adjustment.label} #{((119/totals.subtotal.getNumber()) * adjustment.total.getNumber())|round}%" : adjustment.label %}
<div class="order-total-line order-total-line__adjustment">
<span class="order-total-line-label">{{ lineLabel }} </span><span class="order-total-line-value">{{ adjustment.total|commerce_price_format }}</span>
</div>
{% endfor %}
<div class="order-total-line order-total-line__total">
<span class="order-total-line-label">{{ 'Total'|t }} </span><span class="order-total-line-value">{{ totals.total|commerce_price_format }}</span>
</div>
</div>
Any hints would be helpful.
Comments
Comment #2
gooddev commentedComment #3
bojanz commentedWhen we added $adjustment->getPercentage() we forgot to update OrderTotalSummary to pass it along.
Comment #5
bojanz commentedPushed a fix. You now have adjustment.percentage in the Twig template.