We can create mixins for Magento_Checkout/js/view/estimation file to modify the core Javascript method or add a new method to the file.
To create mixins, first, create a requirejs-config.js file in the module view/frontend area.
FilePath:
app/code/Jesadiya/Estimation/view/frontend/requirejs-config.js
var config = { config: { mixins: { /** * Mixin for always show sidebar. */ 'Magento_Checkout/js/view/estimation': { 'Jesadiya_Estimation/js/view/estimation-mixin': true } } };
Create Mixins js file to modify the core module’s original file with our changes,
app/code/Jesadiya/Estimation/view/frontend/web/js/view/estimation-mixin.js
define([ 'jquery', 'Magento_Checkout/js/model/sidebar' ], function ( $, sidebarModel ) { 'use strict'; return function (Estimation) { return Estimation.extend({ /** * Show sidebar. */ showSidebar: function () { // you can add custom logic before show sidebar }, }); } });
You can add your custom logic before show sidebar with mixins,
Using the above way you can also modify other functions of estimation.js in the checkout module.