Magento 2 – Extend Checkout Order Summary Section

checkout-pagemagento-2.1.3order-summaryshipping-methods

I am trying to add custom text in beside shipping method section in Order Summary from Magento 2. But my data is not affecting.

enter image description here

For this, I have added custom text in root\vendor\magento\module-checkout\view\frontend\web\template\summary\shipping.html file. But it's not effecting.

<span class="title">Custom Text</span>

Could you please suggest me which file I need to extend to add custom text?

Best Answer

File path should be below

vendor/magento/module-tax/view/frontend/web/template/checkout/summary/shipping.‌​html file

Add your custom <span class="title">Custom Text</span> text like below example

<!-- ko if: isExcludingDisplayed() -->
    <tr class="totals shipping excl">
        <th class="mark" scope="row">
            <span class="title">Custom Text</span>
            <span class="label" data-bind="i18n: title"></span>
            <span class="value" data-bind="text: getShippingMethodTitle()"></span>
        </th>
        <td class="amount">
            <!-- ko if: isCalculated() -->
            <span class="price"
                  data-bind="text: getValue(), attr: {'data-th': title}"></span>
            <!-- /ko -->
            <!-- ko ifnot: isCalculated() -->
            <span class="not-calculated"
                  data-bind="text: getValue(), attr: {'data-th': title}"></span>
            <!-- /ko -->
        </td>
    </tr>
<!-- /ko -->

Run below commands

php bin/magento setup:upgrade 
php bin/magento setup:static-content:deploy
Related Topic