Skip to main content
edited title
Link
simple guy
  • 2.5k
  • 8
  • 32
  • 59

Override js core function in Magento 2

Tweeted twitter.com/StackMagento/status/833561854526029824
Source Link
simple guy
  • 2.5k
  • 8
  • 32
  • 59

Override js function in Magento 2

in backend there is module-sales/view/adminhtml/web/order/create/scripts.js, and inside that js there is a function like this :

loadShippingRates : function(){
            this.isShippingMethodReseted = false;
            this.loadArea(['shipping_method', 'totals'], true, {collect_shipping_rates: 1});
        }

i want to change the function, so it will send another data to loadArea function like this:

loadShippingRates : function(){
            this.isShippingMethodReseted = false; 
            var yeezy= jQuery('#order-billing_address_yeezy').val();
            this.loadArea(['shipping_method', 'totals'], true, {collect_shipping_rates: 1, yeezy_is_ready_yoo: yeezy});
        }

when i change from pub/static my custom function works fine, but i don't know how to override this function from custom extension