Create plugin for Calculate method of Totals Information ManagementInterface Magento 2.

Magento 2,  You can create a plugin to TotalsInformationManagementInterface of Checkout Module to modify or change quote total.

An Interface responsible for Calculate quote totals based on address and shipping method.

Interface class:

An interface contains the calculate() method to fetch quote totals based on the address and shipping method.

if you need to modify the total information you can use before plugin based on your total customization.

Path: app/code/Jesadiya/TotalInfo/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi=""
    <type name="Magento\Checkout\Api\TotalsInformationManagementInterface">
        <plugin name="total_modify_plugin" type="Jesadiya/TotalInfo\Plugin\TotalsInformationManagementPlugin"

Now you need to create a PHP class file to defining our logic before calculate the final quote total.

Path: app/code/Jesadiya/TotalInfo/Plugin/TotalsInformationManagementPlugin.php

namespace Jesadiya\TotalInfo\Plugin;

use Magento\Quote\Model\Quote;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Checkout\Api\Data\TotalsInformationInterface;
use Magento\Checkout\Api\TotalsInformationManagementInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;

class TotalsInformationManagementPlugin
     * @var CartRepositoryInterface
    private $cartRepository;

    public function __construct(
        Config $config,
        CartRepositoryInterface $cartRepository
    ) {
        $this->cartRepository = $cartRepository;

     * @param TotalsInformationManagementInterface $subject
     * @param int                                  $cartId
     * @param TotalsInformationInterface           $addressInformation
     * @return mixed[]|null
     * @throws LocalizedException
     * @throws NoSuchEntityException
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
    public function beforeCalculate(
        TotalsInformationManagementInterface $subject,
        int $cartId,
        TotalsInformationInterface $addressInformation
    ) {

        // You got the current quote by cart id and modify your code based on customization
        /** @var Quote $quote */
        $quote = $this->cartRepository->get($cartId);
            // start your own logic.....
        return null;

Using the above method beforeCalculate() you can modify the behaviour of the calculate method.

You can also use AfterCalculate() method if you want to change the total info after the final total calculated.