Magento – Magento 2 : Update Order Summary Block On Checkout Page

blockscheckoutmagento2

I already look into this : how to add fee to order totals in magento2

I need to added additional fee based on shipping address, So I used this plugin

<type name="Magento\Checkout\Model\ShippingInformationManagement">
        <plugin name="get_shipping_info" type="Company\Vendor\Plugin\Checkout\Model\ShippingInformationManagement" sortOrder="1" disabled="false"/>
    </type>

It sucessfully work and update value of fee in "quote" table in database.

But it not update fee value in checkout summary block.
enter image description here

How can I update this summary block, So it get updated value from database.
How can I update block on selection of any payment method selection or any other way.

Best Answer

Summary section created on checkout-module. You can change checkout_index_index.xml, add item as 'quote' & create js for
Magento_Checkout/js/view/summary/quote

Path - \vendor\magento\module-checkout\view\frontend\layout\checkout_index_index.xml

<item name="quote" xsi:type="array">
    <item name="component"  xsi:type="string">Magento_Checkout/js/view/summary/quote</item>
    <item name="config" xsi:type="array">
        <item name="title" xsi:type="string" translate="true">Quote</item>
    </item>
</item>

\vendor\magento\module-checkout\view\frontend\web\js\view\summary

Also create template file in below path. vendor\magento\module-checkout\view\frontend\web\template\summary

You can override this file on you custom extension or update core files (Not recommended). This might not be exact answer but might be workaround to you. Hope this help you.