Question

I need to remove subtext of shipping in checkout summary here tried as below location enter image description here

/app/design/frontend/Vendor/theme-web/Magento_Checkout/web/js/view/summary/shipping.js

here I returning blank but still () is appearing. how to remove this

define(
    [
        'jquery',
        'Magento_Checkout/js/view/summary/abstract-total',
        'Magento_Checkout/js/model/quote'
    ],
    function ($, Component, quote) {
        return Component.extend({
            defaults: {
                template: 'Magento_Checkout/summary/shipping'
            },
            quoteIsVirtual: quote.isVirtual(),
            totals: quote.getTotals(),
            getShippingMethodTitle: function() {
                if (!this.isCalculated()) {
                    return '';
                }
                var shippingMethod = quote.shippingMethod();
                return shippingMethod ? '' : '';  //HERE Returning Blank***
            },
            isCalculated: function() {
                return this.totals() && this.isFullMode() && null != quote.shippingMethod();
            },
            getValue: function() {
                if (!this.isCalculated()) {
                    return this.notCalculatedMessage;
                }
                var price =  this.totals().shipping_amount;
                return this.getFormattedPrice(price);
            }
        });
    }
);

where am I doing wrong? Can I get help? Thank you in advance

Was it helpful?

Solution 2

Here I found my answer by Overriding below file

app/design/frontend/Vendor/theme-web/Magento_Checkout/web/template/cart/totals/shipping.html

<th class="mark" colspan="1" scope="row" data-bind="text: title + ' (' + getShippingMethodTitle() + ')'"></th>

Replace this With

<th class="mark" colspan="1" scope="row">SHIPPING COST</th>

OTHER TIPS

Override shipping.html in your theme.

<!-- ko if: quoteIsVirtual == 0 -->
    <tr class="totals shipping excl">
        <th class="mark" scope="row">
            <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 -->

And comment span tag and then check it.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top