0

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...!

  • @Patel Did you solve this? – Mano M Nov 4 at 9:14
  • @ManoM Yes, After deep into the code found that you can't use mixins in this case. I will provide my solution soon here. – Prince Patel Nov 4 at 10:52
  • Okay, @Patel. Thanks for the quick response. – Mano M Nov 4 at 11:16

Your Answer

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

Browse other questions tagged or ask your own question.