protected function determineOrderItemTaxes(ItemInterface $orderItem, array $pricesToBeTaxed, $pricingContext) { $rate = 0; $taxes = array(); $totalTax = 0; //We currently assume that all order items use the default tax zone and associated tax rate $taxZone = $pricingContext->get('taxZone'); if (null != $taxZone) { $rate = $taxZone->getDefaultRate(); } //Each price which should be taxed is aggregated into one value, for instance shipment tax + sales tax //This is especially true for flat rate taxes, but insufficient for mixed tax rates foreach ($pricesToBeTaxed as $name => $value) { $taxValue = $rate * $value / 100; $totalTax += $taxValue; } $orderItem->setPrice('totalTax', $totalTax); }