I want to override function setShippingMethod() to my module js vendor\magento\module-sales\view\adminhtml\web\order\create\scripts.js

here is a function

], function(jQuery, confirm, alert){

    window.AdminOrder = new Class.create();

    AdminOrder.prototype = {
        setShippingMethod : function(method){
            var data = {};
            data['order[shipping_method]'] = method;
            this.loadArea(['shipping_method', 'totals', 'billing_method'], true, data);
                jQuery( "#click-me" ).trigger( "click" );



To overide that things, you need to do this things.

  1. Vendor\Extension\view\adminhtml\requirejs-config.js add this:

    var config = {
      map: {
        '*': {
  2. Then create the file Vendor\Extension\view\adminhtml\web\order\create\scripts.js with your content.

  • I want to override only one function instead file, this function declared with some different syntax, that's why I'm asking – Ketan Borada Oct 14 at 4:53
  • single function is not possible, but in this way when you overide this one, you need to modify only that function, rest of the things you need to take as it is. – Dhiren Vasoya Oct 14 at 5:15

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.