2

I want to override switchPaymentMethod from module-sales/view/adminhtml/web/order/create/scripts.js for that I use mixins:

app/code/Vendor/Module/view/adminhtml/requirejs-config.js

var config = {
    config: {
        mixins: {
            'Magento_Sales/order/create/scripts': {
                'Vendor_Module/order/create/scripts-mixin': true
            }
        }
    }
};

app/code/Vendor/Module/view/adminhtml/web/order/create/scripts-mixin.js

define(function () {
    'use strict';

    var mixin = {
        switchPaymentMethod: function(method){
            console.log('funcion called');
            //Main Code
        },
    };

    return function (target) {
        return target.extend(mixin);
    };
});

I got this error in console: Cannot read property 'extend' of undefined

I also tried with override AdminOrder.prototype = { }

Any help would be appreciated...!

Prince Patel
  • 22,708
  • 10
  • 97
  • 119

1 Answers1

0

you must change config to :

var config = {
    config: {
        mixins: {
            'Vendor_Module/order/create/scripts-mixin' : {
                'Magento_Sales/order/create/scripts': true
            }
        }
    }
};
A. jouni
  • 1
  • 1