Skip to content

How to change cart subtotal price in order summary block magento2

How can I do that?

this is my code.

$quote = $this->checkoutSession->getQuote();
$grand_total = $quote->getGrandTotal();
$new_grand_total = $grand_total + $fee;

$quote->setGrandTotal($new_grand_total);
$quote->setBaseGrandTotal($new_grand_total); 
$quote->collectTotals();
$quote->save();
$this->checkoutSession->getQuote()->collectTotals()->save();