Access Surcharge Information via Code
Our Surcharge extensions save their total information as an extension attribute. The below code shows how you would access the individual totals:
private function addFoomanTotalLines($magentoSalesOrder) { $extAttr = $magentoSalesOrder->getExtensionAttributes(); if (!$extAttr) { return; } $foomanGroup = $extAttr->getFoomanTotalGroup(); if (empty($foomanGroup)) { return; } $totals = $foomanGroup->getItems(); if (empty($totals)) { return; } foreach ($totals as $total) { /** @var \Magento\Quote\Api\Data\OrderTotalInterface $total */ $description = $total->getLabel(); $baseAmount = $total->getBaseAmount(); $baseTaxAmount = $total->getBaseTaxAmount(); $identifier = $total->getTypeId(); $qty = 1; } }