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.

Total Summary

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.

CommentFileSizeAuthor
Bildschirmfoto 2017-10-19 um 00.01.57.png15.22 KBgooddev

Comments

dev.tim created an issue. See original summary.

gooddev’s picture

Issue summary: View changes
bojanz’s picture

Title: How get tax percentage in order total summary » The order total summary doesn't have access to adjustment percentages
Version: 8.x-2.0 » 8.x-2.x-dev
Component: Tax » Order
Category: Support request » Bug report
Issue tags: -tax, -percentage, -order total summary

When we added $adjustment->getPercentage() we forgot to update OrderTotalSummary to pass it along.

  • bojanz committed 4c1205c on 8.x-2.x
    Issue #2917222 by dev.tim, bojanz: The order total summary doesn't have...
bojanz’s picture

Status: Active » Fixed

Pushed a fix. You now have adjustment.percentage in the Twig template.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.