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([]);
    };
} 
);

1 Answer 1

1

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);
        };
    }
});
1
  • ok i will check and let you know Apr 26, 2019 at 15:43

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .