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


You can override core js file using below way,


Keep requirejs-config.js file at below location for override core js file, app/code/Namespace/Modulename/view/adminhtml/requirejs-config.js

 var config = {
        map: {
            '*': {
                "Magento_Sales/js/order/create/script": 'Namespace_Modulename/js/order/create/script',
  • should i write all the code or just the function i want to rewrite?
    – simple guy
    Feb 20 '17 at 5:28
  • 1
    you can write all code. Feb 20 '17 at 5:29
  • can i just write the function that i want to override?
    – simple guy
    Feb 20 '17 at 5:34
  • i havent try with only function, May be you can done it with only function. jsut try with that and check. Feb 20 '17 at 5:35
  • have you check using only function? Feb 20 '17 at 6:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.