0

when trying to override select-shipping-method.js in my custom module then getting this errors

1 - Uncaught Error: Script error for: Xyz_Customcheckout/js/model/quote http://requirejs.org/docs/errors.html#scripterror at makeError (require.js:166) at HTMLScriptElement.onScriptError (require.js:1681)

2 - GET http://127.0.0.1/xyz/abc/pub/static/version1556282180/frontend/Xyz/theme/en_US/Xyz_Customcheckout/js/model/quote.js net::ERR_ABORTED 404 (Not Found)

requirejs -

var config = {
    map: {
        '*': {


          'Magento_Checkout/js/action/select-shipping-method': 'Xyz_Customcheckout/js/action/select-shipping-method'

        }
  }
};

select-shipping-method.js

define(
[
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/action/set-shipping-information'
],
function (quote, setShippingAction) {
    "use strict";

    return function (shippingMethod) {
        quote.shippingMethod(shippingMethod);
        // Update totals on summary
        setShippingAction([]);
    };
} 
);
0

app/code/SR/MagentoCommunity/view/frontend/requirejs-config.js

var config = {
    config: {
        mixins: {
            'Magento_Checkout/js/action/select-shipping-method': {
                'SR_MagentoCommunity/js/mixin/select-shipping-method-mixin': true
            }
        }
    }
};

app/code/SR/MagentoCommunity/view/frontend/web/js/mixin/select-shipping-method-mixin.js

define([
    'jquery'
], function ($) {
    'use strict';

    return function (target) {
        return function (shippingMethod) {
            // call original method
            target(shippingMethod);
        };
    }
});
  • ok i will check and let you know – sumeet bajaj Apr 26 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.