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

asked Aug 12, 2019 at 17:56
4
  • @Patel Did you solve this? Commented Nov 4, 2019 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. Commented Nov 4, 2019 at 10:52
  • Okay, @Patel. Thanks for the quick response. Commented Nov 4, 2019 at 11:16
  • You can use this solution: magento.stackexchange.com/questions/272577/… Commented Mar 6, 2020 at 5:25

1 Answer 1

0

you must change config to :

var config = {
 config: {
 mixins: {
 'Vendor_Module/order/create/scripts-mixin' : {
 'Magento_Sales/order/create/scripts': true
 }
 }
 }
};
answered Feb 12, 2021 at 9:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.