0

I have created the module, now I want to override the vendor\magento\module-catalog\view\base\web\js\price-utils.js file in my custom module to change in one function.

I tried with below code:

  • created requrejs-config.js file in the module as below:
var config = {
    map: {
        '*': {
            'Magento_Catalog/js/price-utils': 'Name_Module/js/price-utils-override'
        }
    }
};

then copy the file into my module Name\Module\view\frontend\web\js\view\price-utils-override.js.

after content deploy command. it is giving error as below "http://127.0.0.1/test/pub/static/version1545992807/frontend/theme/name/en_GB/Name_Module/js/price-utils.js net::ERR_ABORTED 404 (Not Found)".

What is wrong here, please let me know if anyone has any idea about it.

Thanks.

1 Answer 1

1

Try below solution

requrejs-config.js

var config = {
    map: {
        '*': {
            'Magento_Catalog/js/price-utils': 'Name_Module/js/view/price-utils-override'
        }
    }
};

then run below CMD

php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento cache:clean
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean
rm -rf var/*
rm -rf generated/*

I think you missed view in requrejs-config.js file.

I hope it help..!!!

3
  • appreciated your answer but I am using the module not the theme. Dec 28, 2018 at 11:52
  • @UtsavGupta try my new answer's code. Dec 28, 2018 at 12:05
  • @UtsavGupta welcome :) . Please upvote my answer also so that will help another devlopers. Dec 28, 2018 at 12:09

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.