0

I want to override step-navigator js file. I had followed this method How to extend js class/method of checkout model class in magento 2 but it didn't work. any help.

I want to override this method.

navigateTo: function (code, scrollToElementId) {

    },

My code in require js file

var config = {
'config': {
'mixins': {
    'Magento_Checkout/js/view/shipping': {
        'Av_ShoppingCart/js/view/shipping-payment-mixin': true
    },
    'Magento_Checkout/js/view/payment': {
        'Av_ShoppingCart/js/view/shipping-payment-mixin': true
    },
    'Magento_Checkout/js/model/step-navigator': {
            'Av_ShoppingCart/js/model/step-navigator': true
     }
}

}

My code of customizing step-navigator file

define(function () {
'use strict';

return function (target) { 
    var navigateTo = target.navigateTo;
    target.navigateTo = function(code, scrollToElementId) {

        alert("safasfaf");

        var result = navigateTo.apply(this, arguments);
        // //after method call
        return  result;
    };
    return target.
};

});

  • Can you tell me what issue you are facing? – Dhiren Vasoya Apr 12 '18 at 14:07
  • It's not showing me the alert when i click on one of the navigator. – Avesh Naik Apr 12 '18 at 14:30
0

To overide step navigator: create a requirejs-config.js file under view/frontend/web Add the following code in your requirejs-config.js file:

var config = {
    "map": {
        "*": {
            "Magento_Checkout/js/model/step-navigator": 
"Av_ShoppingCart/js/model/step-navigator",
        }
    }
};

copy the Magento_Checkout/js/model/step-navigator.js from the core and add it in your module Av_ShoppingCart/js/model/step-navigator.js.

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.