I try to understand knockoutjs and requirejs more but I fail to understand the following case.
In checkout the shipping method title is showing in the summary
This is the template:
vendor/magento/module-tax/view/frontend/web/template/checkout/summary/shipping.html
...
<span class="value" data-bind="text: getShippingMethodTitle()"></span>
...
The method getShippingMethodTitle()
seems to be defined here:
vendor/magento/module-tax/view/frontend/web/js/view/checkout/cart/totals/shipping.js (Script A)
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Tax/js/view/checkout/summary/shipping',
'Magento_Checkout/js/model/quote'
], function (Component, quote) {
'use strict';
return Component.extend({
/**
* @override
*/
isCalculated: function () {
return !!quote.shippingMethod();
},
/**
* @override
*/
getShippingMethodTitle: function () {
return '(' + this._super() + ')';
}
});
});
It just returns this._super()
so it means it tries to access the parent method _super,
but where is the parent? I think Component
is the parent, but there is no method called _super
in 'Magento_Tax/js/view/checkout/summary/shipping'
So how does it know the method name?