We can achieve it through the event and Observer, where will use event sales_quote_address_collect_totals_after.
Need to create a custom module and configure an event. Let’s say our module is Osc_Tax.
Example of events code (app\code\Osc\Tax\etc\events.xml)
Example of Observer code (app\code\Osc\Tax\Observer\Customtax.php)
<?php
namespace Osc\Tax\Observer;
use \Magento\Framework\Event\ObserverInterface;
use \Magento\Framework\Event\Observer;
class Customtax implements ObserverInterface
{
public $additionalTax = 4;
public function execute(Observer $observer)
{
$getTotal = $observer->getData('total');
if (count($getTotal->getAppliedTaxes()) > 0) {
$getTotal->addTotalAmount('tax', $this->additionalTax);
}
return $this;
}
}
In this Example code, $additionalTax variable have additional tax amount.