I have code for add extra fee in order in magento 2, now my requirement is the extra fee can only show will be not add in order total
the extra free can also add in order total but I can not add that
I need order total 155 not 160
my code is that
public function collect(
\Magento\Quote\Model\Quote $quote,
\Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
\Magento\Quote\Model\Quote\Address\Total $total
)
{
parent::collect($quote, $shippingAssignment, $total);
if (!count($shippingAssignment->getItems())) {
return $this;
}
$enabled = $this->helperData->isModuleEnabled();
$minimumOrderAmount = $this->helperData->getMinimumOrderAmount();
$subtotal = $total->getTotalAmount('subtotal');
if ($enabled && $minimumOrderAmount <= $subtotal) {
$fee = $quote->getFee();
$total->setTotalAmount('fee', $subtotal);
$total->setBaseTotalAmount('fee', $subtotal);
$total->setFee($fee);
$quote->setFee($fee);
$total->setGrandTotal($total->getGrandTotal());
$total->setBaseGrandTotal($total->getBaseGrandTotal());
}
return $this;
}